Get Player ID from name
#1

FIXED
Reply
#2

PHP код:
new name[MAX_PLAYER_NAME], targetid=-1// String who will store players name, targetid who will store the targetid.
for(new i=0,j=GetMaxPlayers();i<j;i++) // Loop players
if(IsPlayerConnected(i)) // If playerid connected
{
    
GetPlayerName(inamesizeof(name)); // Get ID's name
    
if(!strcmp(name,"Target_Name"// Checks if the Id's name is what we wanted.
    
{
        
targetid i// Defines targerid
        
break; //No need to contuine the loop.
    
}
}
if(
targetid==-1)return Player Not Found // If player not found, returns MSG for exmple. 
Reply
#3

i make it with my self but anyway thanks
Reply
#4

You can also use the function ReturnUser(string)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)