checkpoint timer help
#1

public OnPlayerEnterCheckpoint (playerid )
{
GivePlayerMoney (playerid, 10000 );
DisablePlayerCheckpoint( playerid ) ;
return 1 ;
}

I want not to disable checkpoint instantly when player enter cp. I want checkpoint should be cleared after 5 minutes when player enter it then after that new cp will come.

p.s when one player enter cp the timer starts for second cp to come.
Reply
#2

plz someone help
Reply
#3

Code:
public OnPlayerEnterCheckpoint (playerid )
{
GivePlayerMoney (playerid, 10000 );
SetTimerEx("NextCheckpoint1", 30000, false, "i", playerid);
return 1 ;
}

forward NextCheckpoint1(playerid);
public NextCheckpoint1(playerid)
{
DisablePlayerCheckpoint( playerid ) ;
SetTimerEx("NextCheckpoint2", 30000, false, "i", playerid);
// Create checkpoint here, see the example below
return 1 ;
}

// ... here proceed to checkpoint 3, 4, 5, 6 etc.
^

Make a timer to remove the old checkpoint and set a new one, and then again and again.
Also, its good to define each checkpoint you set for the player:

Code:
new checkpoint[6]; // 6 is the number of checkpoints you're going to use, only example

checkpoint[0] = Create checkpoint here
checkpoint[1] = Create checkpoint here

//Then you'll destroy each checkpoint separately by using its definition.
You can also use this if you want to know if the player is STAYING in the checkpoint to proceed to the next one, and if they arent - destroy the timers and send a client message like "Mission failed, you got out of the checkpoint!".

https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint
Reply
#4

Quote:
Originally Posted by 1nspire
View Post
Code:
SetTimerEx("NextCheckpoint1", 30000, false, "i", playerid);

SetTimerEx("NextCheckpoint2", 30000, false, "i", playerid);
It completely baffles me how people can pass along a playerid, but not any other variable. Instead writing half a dozen functions that do the exact same thing. If you need to add a number to a function name then you're doing it wrong.
Reply
#5

Quote:
Originally Posted by 1nspire
View Post
Code:
public OnPlayerEnterCheckpoint (playerid )
{
GivePlayerMoney (playerid, 10000 );
SetTimerEx("NextCheckpoint1", 30000, false, "i", playerid);
return 1 ;
}

forward NextCheckpoint1(playerid);
public NextCheckpoint1(playerid)
{
DisablePlayerCheckpoint( playerid ) ;
SetTimerEx("NextCheckpoint2", 30000, false, "i", playerid);
// Create checkpoint here, see the example below
return 1 ;
}

// ... here proceed to checkpoint 3, 4, 5, 6 etc.
^

Make a timer to remove the old checkpoint and set a new one, and then again and again.
Also, its good to define each checkpoint you set for the player:

Code:
new checkpoint[6]; // 6 is the number of checkpoints you're going to use, only example

checkpoint[0] = Create checkpoint here
checkpoint[1] = Create checkpoint here

//Then you'll destroy each checkpoint separately by using its definition.
You can also use this if you want to know if the player is STAYING in the checkpoint to proceed to the next one, and if they arent - destroy the timers and send a client message like "Mission failed, you got out of the checkpoint!".

https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint
very thanks sir

i have one more thing when i did setplayercheckpoint(playerid,xyz)

there appears a red dot on map but there is no red color cp at the point.

plz help and thanks
Reply
#6

Quote:
Originally Posted by Vince
View Post
It completely baffles me how people can pass along a playerid, but not any other variable. Instead writing half a dozen functions that do the exact same thing. If you need to add a number to a function name then you're doing it wrong.
sir can u plz help me i want to send u my gm in pm will u add cp that i have asked sir

plz sir plz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)