As we know that there is a function named GetPlayerIDfromName or something like that...
I want to get the player name from its ID, as my loop(playerson) stores the ID, not the name, so it is the reason of the DB not getting updated onscriptunload()
Is there any way to get it?
Get the player instance using the FindPlayer( ID ) function.
Check if the returned value is not null.
Print the name with player.Name
Any example, I want to use it with a loop
like this
foreach(playerid, val in playerson)
{
local player = FindPlayer(playerid)
print(player)
}
So any Idea to print player name instead of player id?
Or this will work?
foreach(playerid, val in playerson)
{
local plar = FindPlayer(playerid)
local player = plar.Name
print(player)
}
Your method is fine, the only thing is that when we have an ID of anything we use the Find(Player/Pickup/Object/Vehicle/..) to get the instance of that particular id. In your case you when you do local plar = FindPlayer(playerid) then just use plar.Name
Okay!