Checkpoint Need help
#1

I need help in checkpoint i want to set a checkpoint with time for eg:- when i spawn in game the cp will come after 1min and then when someone enter that cp i will end after 2 min.

Thanks in advance.
Reply
#2

Use SetTimerEx (https://sampwiki.blast.hk/wiki/SetTimerEx) to set a timer for one minute, then in the public add the function to create the CP. Do the same thing when somebody enters the CP, except destroy the CP and change the timer to two minutes.
Reply
#3

PHP код:
///When the player spawn (OnPlayerSpawn)
SetTimerEx("ShowCP"60000false"i"playerid);
//New
new CheckPoint[MAX_PLAYERS] = 0;
//Forward
forward ShowCP(playerid);
//Pulibc
public ShowCP(playerid)
{
    if(
CheckPoint[playerid] == 0)
    {
        
SetPlayerCheckPoint(playeridPosXPosYPosZ3.0); //CheckPoint 1
        
CheckPoint[playerid] = 1;
    }
    else if(
CheckPoint[playerid] == 1)
    {
        
SetPlayerCheckPoint(playeridPosXPosYPosZ3.0); //CheckPoint 2
    
}
    return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
    if(
CheckPoint[playerid] == 1//When the player enter on checkpoint 1
    
{
        
DisablePlayerCheckpoint(playerid);
        
SetTimerEx("ShowCP"120000false"i"playerid);
    }    
    return 
1;

Reply
#4

edit:- Ty guys but not working
Reply
#5

Quote:
Originally Posted by Maximun
Посмотреть сообщение
PHP код:
///When the player spawn (OnPlayerSpawn)
SetTimerEx("ShowCP"60000false"i"playerid);
//New
new CheckPoint[MAX_PLAYERS] = 0;
//Forward
forward ShowCP(playerid);
//Pulibc
public ShowCP(playerid)
{
    if(
CheckPoint[playerid] == 0)
    {
        
SetPlayerCheckPoint(playeridPosXPosYPosZ3.0); //CheckPoint 1
        
CheckPoint[playerid] = 1;
    }
    else if(
CheckPoint[playerid] == 1)
    {
        
SetPlayerCheckPoint(playeridPosXPosYPosZ3.0); //CheckPoint 2
    
}
    return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
    if(
CheckPoint[playerid] == 1//When the player enter on checkpoint 1
    
{
        
DisablePlayerCheckpoint(playerid);
        
SetTimerEx("ShowCP"120000false"i"playerid);
    }    
    return 
1;

hey bro it didnt helped when i tested it. It doesnt created any cp
Reply
#6

bump
Reply
#7

Quote:
Originally Posted by Owen007
Посмотреть сообщение
hey bro it didnt helped when i tested it. It doesnt created any cp
It does, but it creates the checkpoint at 0,0,0(If you haven't changed the code), out of your streaming range, so it doesn't show it.


Overall, it's good code.
Reply
#8

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
It does, but it creates the checkpoint at 0,0,0(If you haven't changed the code), out of your streaming range, so it doesn't show it.


Overall, it's good code.
Bro I have changed but cp didnt appear. I will show you my script after somehour? should i?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)