SA-MP Forums Archive
Help with checkpoints - 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: Help with checkpoints (/showthread.php?tid=576311)



Help with checkpoints - Sn4ke2 - 02.06.2015

Hello. Help me please to make this :



Re: Help with checkpoints - mrtms - 02.06.2015

Just make a variable counter and every time the player enters a checkpoint make it add 1.

It's been a while since I've worked with pawn but something like:
public OnPlayerEnterCheckpoint(playerid)
{
drivingSchoolExam[playerid]++;
}

And then make it update the textdraw obviously


Re: Help with checkpoints - Sn4ke2 - 02.06.2015

i don't understand Thank you.


Re: Help with checkpoints - Sn4ke2 - 03.06.2015

up?
somebody >?


AW: Help with checkpoints - Kaliber - 03.06.2015

Well, you make a Checkpoint Array:

PHP код:
stock const Float:cPoints[][] = {
    {
0.00.00.0}, //Start Position
    
{1.00.00.0},
    {
2.00.00.0//etc
};
//The Makro to short it up
#define xCH[%0] cPoints[c_idx[playerid]][%0]
//And a Variable
new c_idx[MAX_PLAYERS]; //And an Checkpoint Index for all players
//OnPlayerConnect
c_idx[playerid] = 0//To reset it
//Now when he starts the driving school
SetPlayerCheckpoint(playerid,xCH[0],xCH[1],xCH[2]);
c_idx[playerid]++; //To show him the next checkpoint
//OnPlayerEnterCheckpoint
if(c_idx[playerid] != 0//To check he is in driving school
{
    if(
c_idx[playerid] == sizeof(cPoints))
    {
        
//Here he is finished
    
}
    else
    {
        
//Here you show him the next Checkpoint
        
new string[64];
        
SetPlayerCheckpoint(playerid,xCH[0],xCH[1],xCH[2]);
        
c_idx[playerid]++;
        
format(string,64,"Checkpoint %d / %d",c_idx[playerid],sizeof(cPoints)+1); //Can you show in a TextDraw
        
TextDrawSetString(textid[playerid], string); //For Example...better use PlayerTextDraws
    
}

I hope you understand


Re: AW: Help with checkpoints - Sn4ke2 - 07.06.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Well, you make a Checkpoint Array:

PHP код:
stock const Float:cPoints[][] = {
    {
0.00.00.0}, //Start Position
    
{1.00.00.0},
    {
2.00.00.0//etc
};
//The Makro to short it up
#define xCH[%0] cPoints[c_idx[playerid]][%0]
//And a Variable
new c_idx[MAX_PLAYERS]; //And an Checkpoint Index for all players
//OnPlayerConnect
c_idx[playerid] = 0//To reset it
//Now when he starts the driving school
SetPlayerCheckpoint(playerid,xCH[0],xCH[1],xCH[2]);
c_idx[playerid]++; //To show him the next checkpoint
//OnPlayerEnterCheckpoint
if(c_idx[playerid] != 0//To check he is in driving school
{
    if(
c_idx[playerid] == sizeof(cPoints))
    {
        
//Here he is finished
    
}
    else
    {
        
//Here you show him the next Checkpoint
        
new string[64];
        
SetPlayerCheckpoint(playerid,xCH[0],xCH[1],xCH[2]);
        
c_idx[playerid]++;
        
format(string,64,"Checkpoint %d / %d",c_idx[playerid],sizeof(cPoints)+1); //Can you show in a TextDraw
        
TextDrawSetString(textid[playerid], string); //For Example...better use PlayerTextDraws
    
}

I hope you understand
Here
PHP код:
stock const Float:cPoints[][] = {
    {
0.00.00.0}, //Start Position
    
{1.00.00.0},
    {
2.00.00.0//etc 
I put checkpoints on SetPlayerRaceCheckpoint ? +REP PLS


Re: Help with checkpoints - Sn4ke2 - 08.06.2015

up? suggestions ?