Engine help. -
ikbenremco - 22.09.2012
I am trieng to implent a new engine system but when the car's spawn when I spawn them or after server restart they just got ENGINE ON and I want it OFF
I got under ongamemodeinit :
Код:
ManualVehicleEngineAndLights();
and
Код:
Engine[vehicle] = 0;
Re: Engine help. -
Squirrel - 22.09.2012
Try this
PHP код:
new Engine[MAX_VEHICLES], Lights[MAX_VEHICLES]; //Top of the script
PHP код:
public OnVehicleSpawn(vehicleid)
{
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
return 1;
}
PHP код:
//Command, you need ZCMD for this
command(engineon, playerid, params[])
{
if(GetPlayerState(playerid) == 2)
{
new vehicle = GetPlayerVehicleID(playerid);
if(Engine[vehicle] == 0)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
Engine[vehicle] = 1;
SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
}
}
else return SendClientMessage(playerid, GREY, "This vehicles engine is already turned on.");
return 1;
}
command(engineoff, playerid, params[])
{
#pragma unused params
if(GetPlayerState(playerid) == 2)
{
new vehicle = GetPlayerVehicleID(playerid);
if(Engine[vehicle] == 1)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
Engine[vehicle] = 0;
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
}
else return SendClientMessage(playerid, GREY, "This vehicle's engine is already off.");
}
else return SendClientMessage(playerid, GREY, "You must be in the drivers seat of a vehicle.");
return 1;
}
Re: Engine help. -
ikbenremco - 22.09.2012
I got that jsut with ZCMD..?
Re: Engine help. -
Squirrel - 22.09.2012
For your fix just add.
PHP код:
public OnVehicleSpawn(vehicleid)
{
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
return 1;
}
If you dont want to use whole command I posted there
Re: Engine help. -
ikbenremco - 22.09.2012
public OnVehicleSpawn(vehicleid) {
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
#if defined DEBUG
printf("[debug] OnVehicleSpawn(%d)", vehicleid);
#endif
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
switch(GetVehicleModel(vehicleid)) {
case 427, 428, 432, 601, 528: SetVehicleHealth(vehicleid, 5000.0); // Enforcer, Securicar, Rhino, SWAT Tank, FBI truck - this is the armour plating dream come true.
}
return 1;
}
alreadyt got.
Re: Engine help. -
TaLhA XIV - 22.09.2012
Why don't you set the vehicle engine to false by using SetVehicleParamsEx?
Re: Engine help. -
ikbenremco - 22.09.2012
Still aint working :
Код:
public OnVehicleSpawn(vehicleid) {
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
#if defined DEBUG
printf("[debug] OnVehicleSpawn(%d)", vehicleid);
#endif
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
switch(GetVehicleModel(vehicleid)) {
case 427, 428, 432, 601, 528: SetVehicleHealth(vehicleid, 5000.0); // Enforcer, Securicar, Rhino, SWAT Tank, FBI truck - this is the armour plating dream come true.
}
return 1;
}
Re: Engine help. -
TaLhA XIV - 22.09.2012
Paste this under OnVehicleSpawn:
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
Re: Engine help. -
ikbenremco - 22.09.2012
Still aint working
Код:
public OnVehicleSpawn(vehicleid) {
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
#if defined DEBUG
printf("[debug] OnVehicleSpawn(%d)", vehicleid);
#endif
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
switch(GetVehicleModel(vehicleid)) {
case 427, 428, 432, 601, 528: SetVehicleHealth(vehicleid, 5000.0); // Enforcer, Securicar, Rhino, SWAT Tank, FBI truck - this is the armour plating dream come true.
}
return 1;
}
Re: Engine help. -
ikbenremco - 23.09.2012
Bump