10.02.2012, 22:56
Hello,i've maked this loc command. (Show location of player)
I've some problems.
It shows location ONLY at id 0,so if i type /loc 1,2,3 etc... it shows only player id 0 location.
If i type an invalid id (ex: player offline),it shows again id 0.
What's wrong?
pawn Код:
CMD:loc(playerid, params[])
{
if(IsSpawned[playerid] == 0) return SendClientMessage(playerid,0xFF0000FF,"You can't use this command when you are dead or spawning.");
if(isnull(params))return SendClientMessage(playerid, 0xFF0000FF, "Usage: /loc [playerid]");
new target, current_zone;
current_zone = player_zone[target];
if(current_zone != -1 && IsPlayerConnected(target)) {
new playername[MAX_PLAYER_NAME],message2[170];
GetPlayerName(target,playername,MAX_PLAYER_NAME);
format(message2,sizeof(message2),"%s(%d)'s current location: %s",playername,target,zones[current_zone][zone_name]);
SendClientMessage(playerid,0x00C7FFAA,message2);
} else {
SendClientMessage(playerid,red,"Invalid Player ID");
}
return true;
}
It shows location ONLY at id 0,so if i type /loc 1,2,3 etc... it shows only player id 0 location.
If i type an invalid id (ex: player offline),it shows again id 0.
What's wrong?