Teleport player by id not working

Hi there,

I want to create a script in which I can specify the citizen’s id the time and password to imprison a citizen.
If I manually put in the “-1” id it does teleport me, however when I get it out of the command it does show the number but it doesn’t imprison me. Does it have something to do with it not being a number or something? I did do float(args[1])

my code:

Hello Sir. You Are Doing it in a wrong way. you are entering Server ID as client id of player. To Get Client ID of player Base of his server id you have to do GetPlayerFromServerId(ServerID).
to be clear: In Fivem Each Player Has Specific Server ID that will never change in any clients. But client id of each player is different for each individual player. for example Player X server id is 5 and his Client ID (for me) is 22. for you His server id is 5 but his client id is 10. And Client side natives Like the one you using(GetPlayerPed) uses Client ID not serverid

Great that explains it very well, cheers!

And Keep in mind that Storing a STRING as a password in Client side is not safe at all. Because If someone knows about Dumping . he can access that password Easily!
Better ways to do it is storing that string in serverside and make a callback that will send the input to the server and get the callback (true/false) that password was correct or nah.

Yes I know this was just for testing, thank you. One more question though I used GetPlayerFromServerId now however it still doesn’t tp me is it because that function does not return a ped?

1 Like
GetPlayerPed(GetPlayerFromServerId(args[1]))

Try using that

1 Like