English I can't reach players name in menu in function

11 replies
Goto Page
To the start Previous 1 Next To the start
Up
acm
User
Offline Off
Code:
1
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


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.
02.06.20 08:13:08 am
Up
BuhaloStrikalo
User
Offline Off
Code:
1
menu(id,"Vote Captain,"..player(1,"name")..",xx")


player(1,"name")


1
02.06.20 09:18:17 am
Up
The Dark Shadow
User
Offline Off
Replace it:
menu(id,"Vote Captain,"..player(1,"name")..",xx")
with
menu(id,"Vote Captain,"..player(id,"name")..",xx")
(Use the next code)
02.06.20 09:01:53 pm
Up
Cure Pikachu
User
Offline Off
I think he wants to like add every player's names currently in-game to the menu, sort of like a dynamic menu.
IMG:https://i.imgur.com/DeSeUxC.png
IMG:https://i.imgur.com/xpsyQRX.png
02.06.20 11:11:49 pm
Up
TrialAndError
User
Offline Off
If what @user Cure Pikachu: said is true then

Code:
1
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


And then add some logic for next page etc
03.06.20 02:14:46 am
Up
Bowlinghead
User
Offline Off
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!
Share time limited free games here
03.06.20 05:07:15 am
Up
acm
User
Offline Off
@user Cure Pikachu: Yes bro you are true.

@user 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.

Code:
1
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


I can reach id 2 or 3,4,5...

I can't reach id 1 name thanks for read.

IMG:https://i.hizliresim.com/nxNcvG.jpg


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

Code:
1
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


IMG:https://i.hizliresim.com/CULe9t.jpg


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
03.06.20 09:51:03 am
Up
Cure Pikachu
User
Offline Off
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.
IMG:https://i.imgur.com/DeSeUxC.png
IMG:https://i.imgur.com/xpsyQRX.png
03.06.20 01:02:45 pm
Up
The Dark Shadow
User
Offline Off
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 user TrialAndError's OOP Menu anyway.
03.06.20 04:20:57 pm
Up
acm
User
Offline Off
@user Cure Pikachu: I can't believe this. You are true bro. My nickname has "|" symbol. This problem due in my nickname. Really thanks bro.

@user 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.

@user 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.
03.06.20 06:57:43 pm
Up
Gaios
Reviewer
Offline Off
@user 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/
To the start Previous 1 Next To the start