SA-MP Forums Archive
Checkpoint Need help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Checkpoint Need help (/showthread.php?tid=609979)



Checkpoint Need help - Owen007 - 18.06.2016

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.


Re: Checkpoint Need help - NoahF - 18.06.2016

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.


Re: Checkpoint Need help - Maximun - 18.06.2016

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;




Re: Checkpoint Need help - Owen007 - 18.06.2016

edit:- Ty guys but not working


Re: Checkpoint Need help - Owen007 - 18.06.2016

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


Re: Checkpoint Need help - Owen007 - 18.06.2016

bump


Re: Checkpoint Need help - Sew_Sumi - 18.06.2016

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.


Re: Checkpoint Need help - Owen007 - 18.06.2016

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?