04.03.2014, 19:00
i have problem with this script GetPlayerIdFromName,
i need to get playerid from this script but it gives me nonsense numbers
the veriable Vardukas is like this:
the "name" is good, i use it to other script witch is connected with this
pawn Код:
stock GetPlayerIdFromName( playername[ ] )
{
for( new i = 0; i <= MAX_PLAYERS; i++ )
{
if( IsPlayerConnected( i ) )
{
new
playername2[ MAX_PLAYER_NAME ];
GetPlayerName( i, playername2, sizeof( playername2 ) );
if( strcmp( playername2, playername, true, strlen( playername ) ) == 0 )
{
return i;
}
}
}
return INVALID_PLAYER_ID;
}
pawn Код:
new id = GetPlayerIdFromName( Vardukas );
pawn Код:
new
msg[ 21 ],
pos = strfind( inputtext, "-" );
strmid( msg, inputtext, 0, pos, 21 );
new name[ MAX_PLAYER_NAME ];
format( name, 24, "%s", msg );
Vardukas = name;