16.04.2014, 05:05
Here i created two commands for locating players at their position , if i use /membergps playerid it will start to track player and update player position in every 17 miliseconds this cmd is working correctly but there i created another cmd /stoptracking which will stop to track the players but when i use it , it doesn't remove map icon can anyone tell me what is the mistake here , and what i need to do . Thank you in advance for your help
This Is My Code:
This Is My Code:
pawn Код:
CMD:stoptracking(playerid, params[])
{
#pragma unused params
if(pInfo[playerid][pClan] ==1 || pInfo[playerid][pClanleader] == 1 || IsPlayerAdmin(playerid))
{
SetTimerEx("Updatemapicon",17,false,"i",playerid);
RemovePlayerMapIcon(playerid,1);
SCM(playerid,-1,""COL_GREEN"You have successfully removed Map Icon");
}else return SCM(playerid, -1,""COL_RED"[ERROR] You need to be RCON admin/Clan Leader/Clan Member to use this Command.");
return 1;
}
CMD:membergps(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid) || pInfo[playerid][pClanleader] == 1 || pInfo[playerid][pClanleader] == 1)
{
new pplayerid;
if(sscanf(params,"d",pplayerid)) return SCM(playerid, -1,""COL_RED"[ERROR]: /membergps [playerid]");
if(pplayerid == playerid)
{
if(TrackingClan == 0)
{
new Float:x,Float:y,Float:z;
if(pInfo[pplayerid][pClanleader] || pInfo[pplayerid][pClan])
{
GetPlayerPos(pplayerid,x,y,z);
SetPlayerMapIcon(playerid,1,x,y,z,2,0,1);
TrackingClan = 2;
SetTimerEx("Updatemapicon",17,true,"i",playerid);
}else return SCM(playerid,-1,""COL_RED"You can not track players instead of Clan members");
}else return SCM(playerid,-1,""COL_RED"You are already Tracking Clan Player(s)\n\
First Stop Tracking Then Try To Re-Track Them(USE:/stoptracking)");
}else return SCM(playerid,-1,""COL_RED"You can not track yourself");
}else return SCM(playerid, -1,""COL_RED"[ERROR] You need to be RCON admin/Clan Leader/Clan Member to use this Command.");
}else return SCM(playerid,-1,""COL_RED"Player Is Not Connected");
return 1;
}
forward Updatemapicon(playerid);
public Updatemapicon(playerid)
{
new ID;
if(pInfo[ID][pClan] == 1 || pInfo[ID][pClanleader] == 1)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(ID,x,y,z);
SetPlayerMapIcon(playerid,1,x,y,z,2,0,1);
}
return 1;
}