Question about Checkpoints -
Sarra - 01.08.2014
Hello , I want to know if there's a function that allows me to know if the player has already a checkpoint, so If he has one he will need to /deletecheckpoint to have another! I just need to know if there's a function that may help,
Re: Checkpoints -
Slicebook - 01.08.2014
Код:
DisablePlayerCheckpoint(playerid);
Код:
CMD:deletecheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
return 1;
}
Код:
if(!strcmp(cmdtext, "/deletecheckpoint", true))
{
DisablePlayerCheckpoint(playerid);
return 1;
}
Re: Checkpoints -
Sarra - 01.08.2014
that's not What I meant
I mean, like If he uses /checkpoint (a checkpoint appears) then he uses /checkpoint again (a message will appear, U already have 1 active checkpoint, use /deletecheckpoint to delete it)
All I want is the "1 active checkpoint " message, but can't find if there's a function that indicates if the player has a checkpoint already or not
Re: Checkpoints -
Slicebook - 01.08.2014
Sorry, bad English..it?
new uKikepzes[256];
public OnPlayerEnterCheckpoint(playerid)
{
if(uKikepzes[playerid] == 1){ // <1check
uKikepzes[playerid] = 2;
SetPlayerCheckpoint(playerid,1524.1716,1254.2545,1 3.8625,3); //<< agreed to
return 1;
}
if(uKikepzes[playerid] == 2){
uKikepzes[playerid] = 0; // stop
DisablePlayerCheckpoint(playerid); <<<disable
return 1;
}
return 1;
}
CMD:teszt1(playerid)
{
uKikepzes[playerid] = 1;
SetPlayerCheckpoint(playerid,1524.1716,1254.2545,1 3.8625,3);
}
Re: Checkpoints -
Sarra - 01.08.2014
I'll make it simple: If someone who already has an active checkpoint uses another checkpoint command a message will appear saying "You already have an active checkpoint, please delete it before having another one"
Just that
Re: Checkpoints -
Konstantinos - 01.08.2014
It resets the checkpoint's position so there wouldn't be any problem. If you still want to display that message, create an array for the players and set it to 0 on connect. Then to 1 in the command to active the checkpoint and in the command to disable it, set it back to 0. All you have to do then is check if the value of the variable is 1 and return the error.
Re: Question about Checkpoints -
davve95 - 02.08.2014
Quote:
Originally Posted by Sarra
Hello , I want to know if there's a function that allows me to know if the player has already a checkpoint, so If he has one he will need to /deletecheckpoint to have another! I just need to know if there's a function that may help,
|
You can use variables something like this:
https://sampforum.blast.hk/showthread.php?tid=464726
Place:
Cp[playerid]=1;
When they picked it up.
On your command:
pawn Код:
CMD:Your Cmd(playerid, params[])
{
if(Cp[playerid] == 1)
{
Cp[playerid] = 0;
}
else SendClientMessage(playerid, color, message");
And under OnPlayerSpawn:
OnPlayerSpawn
{
Cp[playerid] = 0);
}
Put this on top too.
new cp[MAX_PLAYERS];
Maybe not good explained but I used my phone and did it very fast.
Edit: Didn't saw Konstantinos post as the page reloaded when I posted.