dcmd_id(playerid, params[]) { new id, playername[24] ,string[256]; if (sscanf(params, "d", id, GetName(id))) return SendClientMessage(playerid, 0xFF0000AA, "Utilisation: \"/id <nom du joueur>\""); else if (!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Joueur non trouve"); else { GetPlayerID(playerid); format(string, sizeof(string), "%s 's IDis %d.", playername, id); SendClientMessage(playerid, 0xFFFF00AA, string); } return 1; }
stock GetPlayerID(const name[]) { new pName[MAX_PLAYER_NAME]; for(new i = 0; i < MAX_PLAYERS; i++) { if(!IsPlayerConnected(i)) continue; GetPlayerName(i, pName, MAX_PLAYER_NAME); if(!strcmp(pName, name)) return i; } return INVALID_PLAYER_ID; }
GetPlayerID(playerid);
dcmd_id(playerid, params[]) { new id, playername[24] ,string[256]; if (sscanf(params, "s", playername)) return SendClientMessage(playerid, 0xFF0000AA, "Utilisation: \"/id <nom du joueur>\""); else { id=GetPlayerID(playername); format(string, sizeof(string), "%s 's ID is %d.", playername, id); SendClientMessage(playerid, 0xFFFF00AA, string); } return 1; }
C:\Documents and Settings\Ludovic\Bureau\GTA\samp03csvr_R2-2_win32\pawno>.\pawnc c .\Area51.pwn Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase .\Area51.pwn(990) : error 035: argument type mismatch (argument 1) .\Area51.pwn(996) : error 017: undefined symbol "playername" .\Area51.pwn(984) : warning 204: symbol is assigned a value that is never used: "pName" 2 Errors. Appuyez sur une touche pour continuer...
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;
}
's id is 1 's id is 2 's id is 3 ... 's id is 499 's id is 500 |