[Command] Give a player's ID from a command
#6

Better use strfind, so you can search for parts of names:
pawn Код:
dcmd_id( playerid, params[ ] ) {
    if( !strlen( params ) ) {
        SendClientMessage( playerid, -1, "Utilisation: '/id <nom du joueur>'" );
        return 1;
    }
    for( new i = 0; i < MAX_PLAYERS; i++ ) {
        new
            pName[ 24 ],
            string[ 128 ]
        ;
        GetPlayerName( i, pName, 24 );
        if( strfind( params, pName, true ) ) {
            format( string, sizeof string, "%s's ID is %d", pName, i );
            SendClientMessage( playerid, -1, string );
        }
    }
    return 1;
}
Untested.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)