I can't reach players name in menu in function
11 replies



02.06.20 05:43:36 am
Code:
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
function votecpt()
for id=1,32 do
if player(id,"exists") then
menu(id,"Vote Captain,"..player(1,"name")..",xx")
end
end
timer(10000,"votcptends","",1)
end
for id=1,32 do
if player(id,"exists") then
menu(id,"Vote Captain,"..player(1,"name")..",xx")
end
end
timer(10000,"votcptends","",1)
end
I can't reach players name in menu in function, if i use a msg like msg(player(id,"name") i can reach but if i use it on menu i can't access player(id,"name") can u guys help. Thanks for read.
Replace it:
menu(id,"Vote Captain,"..player(1,"name")..",xx")
with menu(id,"Vote Captain,"..player(id,"name")..",xx")
(Use the next code) I think he wants to like add every player's names currently in-game to the menu, sort of like a dynamic menu.


If what @
Cure Pikachu: said is true then
And then add some logic for next page etc

Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function votecpt()
local menuBuilder = {"Vote Captain"}
for id = 1, 32 do
if player(id,"exists") then
menuBuilder[#menuBuilder+1] = player(id, 'name')
end
end
menu(0, table.concat(menuBuilder, ','))
timer(10000,"votcptends","",1)
end
local menuBuilder = {"Vote Captain"}
for id = 1, 32 do
if player(id,"exists") then
menuBuilder[#menuBuilder+1] = player(id, 'name')
end
end
menu(0, table.concat(menuBuilder, ','))
timer(10000,"votcptends","",1)
end
And then add some logic for next page etc
What are the player-names? Did you use very special chars?
Does your menu got more than 9 menu buttons?
Does the code executed in general? You need an initial "votecpt()" anywhere in your code!
Does your menu got more than 9 menu buttons?
Does the code executed in general? You need an initial "votecpt()" anywhere in your code!
Share time limited free games here

@
Cure Pikachu: Yes bro you are true.
@
Bowlinghead: Calm down Bowling Head you don't need this infos for giving true answer.
Guys i am sorry, I couldn't explain properly.
I mean i'cant reach the name of player id 1.
I can reach id 2 or 3,4,5...
I can't reach id 1 name thanks for read.

I also can't reach player id 1 name in menu on F2 hotkey.

Actually, the problem is not id 1. I can't reach that id, what id i am.

@

Guys i am sorry, I couldn't explain properly.
I mean i'cant reach the name of player id 1.
Code:
1
2
3
4
5
6
2
3
4
5
6
function votecpt()
for id=1,32 do
menu(id,"Vote Captain,"..player(1,"name")..","..player(2,"name")..","..player(3,"name")..","..player(4,"name")..","..player(5,"name")..","..player(6,"name")..","..player(7,"name"))
end
timer(10000,"votcptends","",1)
end
for id=1,32 do
menu(id,"Vote Captain,"..player(1,"name")..","..player(2,"name")..","..player(3,"name")..","..player(4,"name")..","..player(5,"name")..","..player(6,"name")..","..player(7,"name"))
end
timer(10000,"votcptends","",1)
end
I can reach id 2 or 3,4,5...
I can't reach id 1 name thanks for read.

I also can't reach player id 1 name in menu on F2 hotkey.
Code:
1
2
3
4
5
6
2
3
4
5
6
addhook("serveraction","serveraction_hook")
function serveraction_hook(id,action)
if action == 1 then
menu(id,"Normal,"..player(id,"name")..",Slot2")
end
end
function serveraction_hook(id,action)
if action == 1 then
menu(id,"Normal,"..player(id,"name")..",Slot2")
end
end

Actually, the problem is not id 1. I can't reach that id, what id i am.
edited 1×, last 03.06.20 06:06:31 am
Might be useful to mention what sort of name you were using that time in case the cause lies in some specific character(s) in there.


As what I can see so far you're trying to create a script copied of Hajt's competitive script, No need to waste your time on it, Just ask him to give you it. If he didn't give you it, then keep working on your current own script. Hajt uses
TrialAndError's OOP Menu anyway.

@
Cure Pikachu: I can't believe this. You are true bro. My nickname has "|" symbol. This problem due in my nickname. Really thanks bro.
@
Gaios: Dude i don't need them. I don't need any scripts. I just want to ask a question for using player(id,"name") code in menu.
@
The Dark Shadow: It isn't important to use someone else's script. We are developing ourselves here. I wanted to write this script with my own hands, that's all.
Thanks for your interest guys, problem solved.

@

@

Thanks for your interest guys, problem solved.
@
acm: We have given you working scripts, and I can't really help you, because I can't see your images that you have posted. Post it here http://imgur.com/




