SA-MP Forums Archive
A question about checkpoints. - 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: A question about checkpoints. (/showthread.php?tid=593115)



A question about checkpoints. - itaialroy - 01.11.2015

So I'm working with checkpoints atm for a new roleplay job, and I thought to myself:
We seperate them checkpoints from each other using an array, right?
Код:
new CheckpointStatus[MAX_PLAYERS];
Now when playerid 22 logs, he uses box 22 in the array, and lets say he was in the middle of a checkpoint and /qed.
Another player now gets in the game, with ID 22. Wouldn't his checkpoint status already be something different from 0?
I was wondering why no tutorial included anything in OnPlayerDisconnect like:
Код:
CheckpointStatus[playerid] = 0;
Is it un-necessary? why?


Re: A question about checkpoints. - jamesbond007 - 01.11.2015

idk try it .. u can always test it bro.. so easy

i think u have to set it to 0 on player disconnect or connect


Re: A question about checkpoints. - Kevln - 01.11.2015

It is necessary.


Re: A question about checkpoints. - Omer. - 01.11.2015

Use PVars

Код:
SetPVarInt(playerid, "CheckpointStatus", 1);
GetPVarInt(playerid, "CheckpointStatus")
DeletePvar(playerid, "CheckpointStatus"); // when you want to set it to 0
server destroys PVar when player disconnected.

Tutorial: https://sampwiki.blast.hk/wiki/Per-player_variable_system


Re: A question about checkpoints. - PrO.GameR - 01.11.2015

Actually in every single tutorial, it is noted that you should reset all player variables on OnPlayerDisconnect
(Yes, every single one of them, a simple example scenario is that an admin logs out, another player logs in, that ID is still an admin if you don't reset it !)