A question about checkpoints.
#1

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?
Reply
#2

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
Reply
#3

It is necessary.
Reply
#4

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
Reply
#5

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 !)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)