Get Player ID from name
#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


Messages In This Thread
Get Player ID from name - by ScRipTeRi - 15.08.2013, 09:29
Re: Get Player ID from name - by sKgaL - 15.08.2013, 09:39
Re: Get Player ID from name - by ScRipTeRi - 15.08.2013, 09:54
Re : Get Player ID from name - by Garwan50 - 15.08.2013, 11:31

Forum Jump:


Users browsing this thread: 1 Guest(s)