Basic race checkpoint help
#1

Hey me again

I'm on a basic race GM to script but I'm locked with the checkpoints I don't really understand the wiki and I just would some explanation and an example .
And I don't understand that :

Код:
//from Yagu's race filterscript, © by Yagu
public SetRaceCheckpoint(playerid,target,next)
{
     if(next == -1 && Airrace == 0)
         SetPlayerRaceCheckpoint(playerid,1,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
                         0.0,0.0,0.0,CPsize);
     else if(next == -1 && Airrace == 1)
         SetPlayerRaceCheckpoint(playerid,4,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
                         0.0,0.0,0.0,CPsize);
     else if(Airrace == 1)
         SetPlayerRaceCheckpoint(playerid,3,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
                         RaceCheckpoints[next][0],RaceCheckpoints[next][1],RaceCheckpoints[next][2],CPsize);
     else
         SetPlayerRaceCheckpoint(playerid,0,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
                         RaceCheckpoints[next][0],RaceCheckpoints[next][1],RaceCheckpoints[next][2],CPsize);
}
https://sampwiki.blast.hk/wiki/SetPlayerRaceCheckpoint

Ty
Reply
#2

Ok, i explain you the syntax of SetPlayerRaceCheckpoint:

From the wiki:
Quote:

1.playerid The ID of the player to set the checkpoint for

2.Type of checkpoint.0-Normal, 1-Finish, 2-Nothing(Only the checkpoint without anything on it), 3-Air normal, 4-Air finish

3.Float X-Coordinate

4.Float:y Y-Coordinate

5.Float:z Y-Coordinate

6.Float:nextx X-Coordinate of the next point, for the arrow facing direction

7.Float:nexty Y-Coordinate of the next point, for the arrow facing direction

8.Float:nextz Y-Coordinate of the next point, for the arrow facing direction

9.Floatize Size (diameter) of the checkpoint

1. The playerid to set the checkpoint for. Only for this playerid the check will appear.
2. The type of checkpoint. There are 5 types: 0-normal checkpoint, 1-finish for normal checkpoint, 2-nothing (idk where they uses id 2 for) 3-Air (the checkpoint looks like a ring) 4- Air finish, finish for air checkpoints.
3. X coord of the place where you want the check.
4. Y coord of the place where you want the check.
5. Z coord of the place where you want the check.
6. X coord of the place of the next checkpoint (Used to create an arrow that points to the next checkpoint, this is useful for races. If you only use 1 Checkpoint, just fill in the coords from 3)
7. Y coord of the place of the next checkpoint (Used to create an arrow that points to the next checkpoint, this is useful for races. If you only use 1 Checkpoint, just fill in the coords from 4)
8. Z coord of the place of the next checkpoint (Used to create an arrow that points to the next checkpoint, this is useful for races. If you only use 1 Checkpoint, just fill in the coords from 5)
9.The diameter of the checkpoints, here you can determine how big your check gonna be.

I hope you get the syntax now
Greetz
Danny
Reply
#3

So for example i can do this :


(But what's behind?) (playerid, 0, -2744.49, -516.14, 7.65, -2821.91, -430.04, 7.04, 10)

And what I have to do with "Creates a race checkpoint. When the player enters it, the OnPlayerEnterRaceCheckpoint callback is called."?

Thank you
Reply
#4

Quote:

So for example i can do this :


(But what's behind?) (playerid, 0, -2744.49, -516.14, 7.65, -2821.91, -430.04, 7.04, 10)

And what I have to do with "Creates a race checkpoint. When the player enters it, the OnPlayerEnterRaceCheckpoint callback is called."?

Thank you
Yes you can use 'SetPlayerRaceCheckpoint(playerid, 0, -2744.49, -516.14, 7.65, -2821.91, -430.04, 7.04, 10);'
on thay way.

With
Quote:

Creates a race checkpoint. When the player enters it, the OnPlayerEnterRaceCheckpoint callback is called.

they mean: When a player enters a race checkpoint, the code that you entered unterneath OnPlayerEnterRaceCheckpoint will be executed. So:

Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    printf("Player %d entered a race checkpoint!",playerid); // this piece of code will be executed when a player enters a racecheck
    return 1;
}
Reply
#5

So in my race I'm not forced to use OnPlayerEnterRaceCheckpoint?

I'm gonna try it.
Thank you man
Reply
#6

Thanks for your nice help man I did it and it works!

Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerRaceCheckpoint(playerid, 0, -2744.49, -516.14, 7.65, -2821.91, -430.04, 7.04, 10);
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
}
But I got two new questions here if it isn't too much ^^!
First, how can i add more CPs?
And, in this scipt, my players are spawning immediatly after connection to the server but I'd like them to spawn directly in a car. How can i do that?
please and ty again
Reply
#7

So? please help
Reply
#8

https://sampwiki.blast.hk/wiki/CreateVehicle
https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
Reply
#9

hm can you just give me an example of a script with theese functions please?
Reply
#10

You can try this:

Код:
public OnPlayerSpawn(playerid)
{
    new createdpveh[MAX_PLAYERS];
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    createdpveh[playerid] = CreateVehicle(YOUR_MODELID, X, Y, Z, COLOR1,COLOR2,600000);
    PutPlayerInVehicle(playerid, createdpveh[playerid], 0);
    return 1;
}
Replace YOUR_MODELID by your own modelid, COLOR1 and COLOR2 by your colors. Maybe there are some small mistakes in this code, buts thats caused cuz i typed it right in this editor.
Reply
#11

Np -Danny- it works! Thank you for you very nice help everybody
Reply
#12

you can also look in Tutorials section there is 2 Race Tutorials
Links:
https://sampforum.blast.hk/showthread.php?tid=183434
or
https://sampforum.blast.hk/showthread.php?tid=174396
Reply
#13

Thank you kitten I just copy your tut in a pawno to see what it do ingame but i can't compile it due to 26 errors

Код:
(53) : error 017: undefined symbol "TURISMO1"
(54) : error 017: undefined symbol "TURISMO2"
(55) : error 017: undefined symbol "TURISMO3"
(56) : error 017: undefined symbol "TURISMO4"
(57) : error 017: undefined symbol "TURISMO5"
(58) : error 017: undefined symbol "TURISMO6"
(59) : error 017: undefined symbol "TURISMO7"
(60) : error 017: undefined symbol "TURISMO8"
(61) : error 017: undefined symbol "TURISMO9"
(62) : error 017: undefined symbol "TURISMO10"
(63) : error 017: undefined symbol "TURISMO11"
(64) : error 017: undefined symbol "TURISMO12"
(65) : error 017: undefined symbol "TURISMO13"
(66) : error 017: undefined symbol "TURISMO14"
(67) : error 017: undefined symbol "TURISMO15"
(68) : error 017: undefined symbol "TURISMO16"
(69) : error 017: undefined symbol "TURISMO17"
(70) : error 017: undefined symbol "TURISMO18"
(147) : error 017: undefined symbol "TURISMO1"
(148) : error 017: undefined symbol "TURISMO2"
(149) : error 017: undefined symbol "TURISMO3"
(150) : error 017: undefined symbol "TURISMO4"
(151) : error 017: undefined symbol "TURISMO5"
(152) : error 017: undefined symbol "TURISMO6"
(153) : error 017: undefined symbol "TURISMO7"
(154) : error 017: undefined symbol "TURISMO8"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Very helpful and nice tutorial thank you again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)