Checkpoints
#1

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

Код:
DisablePlayerCheckpoint(playerid);
Код:
CMD:deletecheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
return 1;
}
Код:
if(!strcmp(cmdtext, "/deletecheckpoint", true))
{
	DisablePlayerCheckpoint(playerid);
	return 1;
}
Reply
#3

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

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);
}
Reply
#5

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

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)