how to spawn with vehicle . - 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: how to spawn with vehicle . (
/showthread.php?tid=397288)
how to spawn with vehicle . -
[INA]Crazy - 04.12.2012
how to create a script that every player spawn directly into the car
Re: how to spawn with vehicle . -
Konstantinos - 04.12.2012
Like Need For Speed? In OnPlayerSpawn, create a vehicle and put the player in as a driver.
Re: how to spawn with vehicle . -
[INA]Crazy - 04.12.2012
yes , for race gamemode ,
Re: how to spawn with vehicle . -
dr.lozer - 04.12.2012
use this:
pawn Код:
public OnPlayerSpawn(playerid)
{
PutPlayerInVehicle(playerid,vehicleid,0); // Put a vehicle id if you know
return 1;
}
or if you want to create a vehicle and put player in it: use this
pawn Код:
public OnPlayerSpawn(playerid)
{
new Float:x,Float:y,Float:z,Float:a,veh;
GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid, a);
veh = CreateVehicle(model, x,y,z,a,-1,-1,1000); // Put a vehicle model in model E.G: Nrg: 522. Hydra: 520
PutPlayerInVehicle(playerid, veh, 0);
return 1;
}
Re: how to spawn with vehicle . -
Konstantinos - 04.12.2012
pawn Код:
// Global Variable;
new
gVehicle[ MAX_PLAYERS ]
;
public OnPlayerSpawn( playerid )
{
gVehicle[ playerid ] = CreateVehicle( 411, 0.0, 0.0, 0.0, 0.0, 0, 0, 60 ); // 411 - infernus. Change the vehicle/colours etc.
PutPlayerInVehicle( playerid, gVehicle[ playerid ], 0 );
SetVehiclePos( gVehicle[ playerid ], x, y, z ); // Change it to where he/she will spawn!
SetVehicleZAngle( gVehicle[ playerid ], angle ); // Same for this too!
return 1;
}
Note; you should get the player state and if the old_state was driver and the new_state on foot, you should put the player in the car as a driver, because it will be a bit fail!
Re: how to spawn with vehicle . -
[INA]Crazy - 04.12.2012
thanks , reps send ^_^
Re : how to spawn with vehicle . -
will-56 - 04.12.2012
gVehicle[playerid] no ?
xD