Hi, I would like to know how could I get a player by its server id, for example, to make a command to kill or heal a player. I would like the command to be something similar to this: kill [id] and the id to be a number. So then get the player and with the player get the ped or even it steam identifier
You can actually use this native to retrieve the ped:
with this you can do whatever you want.
To get the steamIdentifier use this one:
getPlayerIdentifier(args[1])[1] – args[1] is most probably within your script the targetId. and accessing [1] on the identifiers table should be the steamId.
If I do what suggested @Dvergar about the identifier then it works of course in the server file, but if instead of using that example I try to get the ped of the player using the other native GetPlayerPed(args[1]) then it doesn’t return the ped, why?
–In the Server File
RegisterCommand("test_server", function(source, args)
print(GetPlayerIdentifier(args[1])) --This works
print(GetPlayerPed(args[1])) --But this doesn't, returns 0 which means isn't working. But also doesn't works even using source
end)
I am doing anything wrong, thanks in advance for both answers