Ticked off at a looping timer, KillTimer doesn't work........
#1

well I am scripting a GPS locator system for the PD, now everything works as planned, (checkpoint appears and updates to player position every second) but for some reason when I do the command to kill the locator the checkpoint disappears for one second then just comes back I used..... KillTimer(GPStimer); but it just seems to repeat.....and its starting to tick me off ( no pun intended )


code:

Код:
forward pdGPSt(giveplayerid, playerid);

public pdGPSt(giveplayerid, playerid)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
  {
	 new Float:x, Float:y, Float:z;
	 GetPlayerPos(giveplayerid, x, y, z);
	 SetPlayerCheckpoint(playerid, x,y,z, 0);
  }
	return 1;
}

new GPStimer;

if(strcmp(cmd, "/find", true) == 0)
	{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /find [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			  if(giveplayerid != INVALID_PLAYER_ID)
			  {
			    //if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Find yourself!"); return 1; }
				  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					new Float:X,Float:Y,Float:Z;
					GetPlayerPos(giveplayerid, X,Y,Z);
					SetPlayerCheckpoint(playerid, X,Y,Z, 0);
					GPStimer = SetTimer("pdGPSt", 1000, 1);
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GREY, "  Invalid Name/ID !");
			}
    return 1;
  }

if(strcmp(cmd, "/endfind", true) == 0)
{
		if(IsPlayerConnected(playerid))
		{
      SendClientMessage(playerid, COLOR_LIGHTGREEN, "The PD Tracking System is now Disabled.");
		  KillTimer(GPStimer);
		  DisablePlayerCheckpoint(playerid);
		}
		else
		{
		SendClientMessage(playerid, COLOR_GREY, "You need to be logged in first.");
		}
  	return 1;
	}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)