Multiple spawn areas in race?
#1

Hello!

I read in a thread here on forums someone used this for random Spawn places:
pawn Код:
new Float:RandomSpawnDrag[][] =
{
    // Positions, (X, Y, Z and Facing Angle)
    {-2686.0930,1255.1766,55.2939,0.8892}, // glass dm spawn 1
    {-2692.6455,1255.4932,55.2934,10.5918}, // glass dm spawn 2
    {-2675.6995,1254.8121,55.2935,2.7208}, // glass dm spawn 3
    {-2669.0015,1255.4982,55.2957,357.9764} // glass dm spawn 4
};
And lets say this was in a race, the spawn-area. I dont want any players to spawn up on eachother, and there is only 4 slots.
How can i Use those Positoins to make 4 slots, and make people spawn on their own Position?

Thanks!
Reply
#2

Edit the code you have pasted
pawn Код:
new Float:RandomSpawnDrag[][] =
{
    // Positions, (X, Y, Z and Facing Angle)
    {Spawn Location 1 X,Spawn Location 1 Y,Spawn Location 1 Z,Spawn Location 1 Angle}, // glass dm spawn 1
    {Spawn Location 2 X,Spawn Location 2 Y,Spawn Location 2 Z,Spawn Location 2 Angle}, // glass dm spawn 2
    {Spawn Location 3 X,Spawn Location 3 Y,Spawn Location 3 Z,Spawn Location 3 Angle}, // glass dm spawn 3
    {Spawn Location 4 X,Spawn Location 4 Y,Spawn Location 4 Z,Spawn Location 4 Angle} // glass dm spawn 4
};
Reply
#3

Thats okay, i know that, but how do i put the players in a vehicle, when the race starts, freeze them, etc.

This is a random Code i found somewhere, but is it something like this i have to do ?

pawn Код:
DeathRaceSpawns[EventCars][0], DeathRaceSpawns[EventCars][1], DeathRaceSpawns[EventCars][2], DeathRaceSpawns[EventCars][3], -1, -1, -1);
Reply
#4

Anyone ?
Reply
#5

First of all, you need to decide what to do Scripting is at most an empty world, there's nothing that will be automatically created for you in the GTA SA world, you'll have to script anything by your own.
What i'm trying to say, is that even if you'll know how to freeze the player, set he's position and etc, you'll have to know how to set the race checkpoints, and end the race, and etc.

If you know how to do that, I guess you'll handle this well.

Anyway, to put the player at a race spawn position, you'll need to create a car for him at the wanted place, and put him into the car:
pawn Код:
new c = CreateVehicle(522,DeathRaceSpawns[POSITION][0], DeathRaceSpawns[POSITION][1], DeathRaceSpawns[POSITION][2], DeathRaceSpawns[POSITION][3], -1, -1);
PutPlayerInVehicle(playerid,c,0);
- The "new c" is a variable used to store the vehicle ID. You'll need to store it somewhere else, decided by how your races system works, because you'll have to destroy the car at the end of the race.
- CreateVehicle is the function used to create the car. 522 is the model ID of NRG-500, and you can change it to whatever vehicle model ID you want.
- POSITION is a word that you'll need to replace. If you'll use 0, for example, the player will be teleported to the first spawn. 1 will be the second and etc.
- PutPlayerInVehicle is a function used to... put the player in a vehicle. :O c is the vehicle to put him in and 0 is the seat ID, and we want him to be at seat 0 which is the driver seat.

to freeze the player you simply use TogglePlayerControllable with a second parameter which its value is 0 to freeze or 1 to unfreeze.

GL!
Reply
#6

Okay, Thanks a lot, i really liked the way you explained it D:

I think i am still a bit unsure about the arrays:

pawn Код:
new c = CreateVehicle(522,DeathRaceSpawns[POSITION][0], DeathRaceSpawns[POSITION][1], DeathRaceSpawns[POSITION][2], DeathRaceSpawns[POSITION][3], -1, -1);
PutPlayerInVehicle(playerid,c,0);
That line(s) explains me a lot except from the second "[]". because it goes first
pawn Код:
DeathRaceSpawns[POSITION][0]
and the next one has a "[1]" in it.

And i guess [POSITION] as you showed me is the ones from the RandomSpawnDrag Float?


How can i be sure the player doesnt spawn in the same place as another one?

Thanks!
Reply
#7

Let me Explain it in a different way:

Why is one part

DeathRaceSpawns[POSITION][0]

then another part

DeathRaceSpawns[POSITION][1]

Then

DeathRaceSpawns[POSITION][2] ??

That number which changes, what is it for ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)