public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup])
{
GetVehicleParamsEx(Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup], 1, lights, alarm, doors, bonnet, boot, 0);
}
}
ManualVehicleEngineAndLights();
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
{
if( YOUR_CARGROUP_VAR ) // might be a bool or maybe your own global var but replace it with yours.
{
new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
vehicleid = GetPlayerVehicleID( playerid );
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}
Just put
pawn Код:
|
That is already there but the cars around the city are off o you have to hotwire them or turn them on if you own them but if you have group vehicles they are always turned off and and they need to be always on
|
#define MAX_CAR_GROUP (3) // top
new FcarGroup[ MAX_CAR_GROUP ]; // top
FcarGroup[ 0 ] = CreateVehicle(..); // at Gamemodeinit or whereever you want and remember the array always starts from 0
FcarGroup[ 1 ] = CreateVehicle(..); // 2
FcarGroup[ 2 ] = CreateVehicle(..); // 3
// and so on so forth but do not forget to change the MAX_CAR_GROUP it must be the same.
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
{
new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
vehicleid = GetPlayerVehicleID( playerid );
for(new f = 0; f < MAX_CAR_GROUP; f++)
{
if( vehicleid == FcarGroup[ f ] )
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective); // when player enters in the car group it will automatically turn on the engine.
}
}
}
return 1;
}