Spawn a whole team? - 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: Spawn a whole team? (
/showthread.php?tid=428531)
Spawn a whole team? -
CROSS_Hunter - 06.04.2013
i have 2 teams for my car football gamemode.. and after every goal i need the cars respawn at their usual places [DONE] but also i need the team members respawn at their places.. cuz what happens is the car respawns and the guy in it just as if he was ejected.. so any help?
Re: Spawn a whole team? -
[FSaF]Jarno - 06.04.2013
Instead of respawning the cars, set their position to their spawnpoint. When respawning a car, the possible passengers inside will be ejected, but when setting a vehicle's position, the passengers will teleport with the car.
Also you could hook it up to OnVehicleSpawn and put the players inside the cars once the cars have respawned.
Re: Spawn a whole team? -
CROSS_Hunter - 06.04.2013
Quote:
Originally Posted by [FSaF]Jarno
Instead of respawning the cars, set their position to their spawnpoint. When respawning a car, the possible passengers inside will be ejected, but when setting a vehicle's position, the passengers will teleport with the car.
Also you could hook it up to OnVehicleSpawn and put the players inside the cars once the cars have respawned.
|
Hooking it up there will be hard... cuz the server wont be knowing which vehicle takes which player.. thanks for the idea.. i will try this but i need to stick more to what i asked up there
Re: Spawn a whole team? -
[FSaF]Jarno - 06.04.2013
Make a variable to your script, called something like FootballCarPlayer[MAX_VEHICLES]
When the round starts and the players are put into their vehicles, you store the playerid in the variable
PutPlayerInVehicle(playerid,FootballVehicle);
FootballCarPlayer[FootballVehicle] = playerid;
and on OnVehicleRespawn, put in
PutPlayerInVehicle(vehicleid,FootballCarPlayer[vehicleid],0);
It's simple, really.
EDIT: Note that FootballVehicle is the vehicle that you use in your football script, i just named it footballvehicle for reference.