SA-MP Forums Archive
[Help] /find - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] /find (/showthread.php?tid=488627)



[Help] /find - BornHuman - 18.01.2014

I recently added this command:

Код:
CMD:mdcfind(playerid, params[])
{
if(Faction[playerid] == 1 || Faction[playerid] == 2)
{
    if(Find[playerid] == 0)
    {
        new targetid;
        new Float:x, Float:y, Float:z;
    
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Syntax: /mdcfind [id]");
        if (targetid==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_NEWBIE,"You have entered an invalid player ID.");
	GetPlayerPos(targetid, x, y, z);
	SetPlayerCheckpoint(playerid, x, y, z, 5.0);
    	SendClientMessage(playerid, COLOR_NEWBIE, "You have begun to track your target. Make your way to their location.");
    	SetTimerEx("FindTimer", 1000, 1, "d", targetid);
    	Find[playerid] = 1;
	}
	
	else if(Find[playerid] == 1)
        {
	DisablePlayerCheckpoint(playerid);
    	SendClientMessage(playerid, COLOR_NEWBIE, "Stopped tracking.");
    	Find[playerid] = 0;
	}
}
return SendClientMessage(playerid, COLOR_NEWBIE, "You don't have access to an MDC!");
}
Код:
public FindTimer(playerid)
{
        new targetid;
        new Float:x, Float:y, Float:z;
	GetPlayerPos(targetid, x, y, z);
	SetPlayerCheckpoint(playerid, x, y, z, 5.0);
    	SetTimerEx("FindTimer", 1000, 1, "d", targetid);
    	Find[playerid] = 1;
}
But everytime I start to /mdctrack a player, it goes successfully with updates and all for about 9 SetTimerEx's then it crashes the client. Can anyone help?


Re: [Help] /find - BornHuman - 18.01.2014

Fixed by removing:
Код:
SetTimerEx("FindTimer", 1000, 1, "d", targetid)
From
Код:
public FindTimer(playerid)