23.06.2011, 14:55
Helo, I am making a command that works like that :
- There are 2 players : Gamer1 and Gamer2
- Gamer1 type /id Gamer2 to have Gamer2's ID
- The server returns "Gamer2's ID is [ID]" => [ID] is Gamer2's ID.
I maked this command :
With this stock :
But in game, the server returns my ID, not Gamer2's ID ... I think in the command, the code
returns my ID but not Gamer2's ID.
How can I make the server returns the goos ID please ?
Thanks a lot =)
- There are 2 players : Gamer1 and Gamer2
- Gamer1 type /id Gamer2 to have Gamer2's ID
- The server returns "Gamer2's ID is [ID]" => [ID] is Gamer2's ID.
I maked this command :
Код:
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);
How can I make the server returns the goos ID please ?
Thanks a lot =)


