how to spawn with vehicle .
#1

how to create a script that every player spawn directly into the car
Reply
#2

Like Need For Speed? In OnPlayerSpawn, create a vehicle and put the player in as a driver.
Reply
#3

yes , for race gamemode ,
Reply
#4

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;
}
Reply
#5

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!
Reply
#6

thanks , reps send ^_^
Reply
#7

gVehicle[playerid] no ?
xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)