SA-MP Forums Archive
checkpoint help please - 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: checkpoint help please (/showthread.php?tid=329131)



checkpoint help please - bboytimix - 27.03.2012

hello guys i need a help
i want to make a check point mission mmmm the server have 3 checkpoints
i mean to make an mission for team == 1
if player getin cp he will have evry second its give+1 hp only in the cp
and after 5 minutes the cp will end and player will get +1 score
and when the first cp will end after 10 minutes will be a next cp ... cp2
and this will be the same when player will get in cp he will have evry second +1 hp

please help
thanx for the helper
helper = king!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Re: checkpoint help please - Alternative112 - 28.03.2012

Try this:

Код:
new timer; //Make sure this is global.
new checkpoint;

public OnPlayerEnterCheckpoint(playerid) {
	timer = SetTimerEx("addHealth", 100, true, "i" playerid);
        checkpoint = SetTimerEx("killCheckpoint", 5000, "i", 
	return 1;
}

forward addHealth(playerid);
public addHealth(playerid) {
    new Float:h;
    GetPlayerHealth(playerid, h);
    SetPlayerHealth(playerid, h + 1);
}
Then in an OnPlayerExitCheckpoint, just add in killTimer("timer");. Let me know if that works or not.

If you aren't sure how to make a checkpoint, take a look here: https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint

You can use SetTimerEx just like with the health to delay the destroying of that checkpoint you made (using DisablePlayerCheckpoint(playerid)