28.01.2013, 13:34
Well i played in your server,and i know that it doesn't work,i saw your code but i can't still figure it out. Anyways i made a second way that you can track a player :
The checkpoint will stay at the last position that the player was.
pawn Код:
CMD:track(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsAHitman(playerid) && !IsASoldier(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an PCSD Oficer.");
if(IsACop(playerid) && !PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
if(Tracking[playerid] != -1)
{
DisablePlayerCheckpoint(playerid); //If tracking,disables player checkpoint
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You shut your tracker down.");
return 1;
}
if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /track [playerid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(!PlayerInfo[playerb][pCellphone]) return SendClientMessage(playerid, COLOR_GREY, "Player has no cellphone.");
if(PhoneOff[playerb]) return SendClientMessage(playerid, COLOR_GREY, "Player has their phone turned off.");
if(GetPlayerInterior(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is in an interior.");
if(GetPlayerVirtualWorld(playerb) != GetPlayerVirtualWorld(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Player is in another virtual world.");
// Tracking
Tracking[playerid] = playerb;
format(string, sizeof(string), " You turned your tracker on. (Tracking: %s)", RPN(playerb));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
{
new Float:X,Float:Y,Float:Z; //Float variables, in which to store the X,Y,Z coordinates
GetPlayerPos(playerb, X,Y,Z); //Gets the player coordinates
SetPlayerCheckpoint(playerid, X, Y, Z, 3.0); //Shows it to the one that used /track
}
return 1;
}