SA-MP Forums Archive
Engine help. - 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: Engine help. (/showthread.php?tid=379682)



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 код:
#include ZCMD 
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(engineonplayeridparams[])
{
    if(
GetPlayerState(playerid) == 2)
    {
        new 
vehicle GetPlayerVehicleID(playerid); 
        if(
Engine[vehicle] == 0)
        {
            new 
enginelightsalarmdoorsbonnetbootobjective;
            
GetVehicleParamsEx(vehicleenginelightsalarmdoorsbonnetbootobjective);
            
Engine[vehicle] = 1;
            
SetVehicleParamsEx(vehicle1lightsalarmdoorsbonnetboot0);
        }
    }
    else return 
SendClientMessage(playeridGREY"This vehicles engine is already turned on.");
    return 
1;
}
command(engineoffplayeridparams[])
{
    
#pragma unused params
    
if(GetPlayerState(playerid) == 2)
    {
        new 
vehicle GetPlayerVehicleID(playerid);
        if(
Engine[vehicle] == 1)
        {
            new 
enginelightsalarmdoorsbonnetbootobjective
            
Engine[vehicle] = 0
            
GetVehicleParamsEx(vehicleenginelightsalarmdoorsbonnetbootobjective);
            
SetVehicleParamsEx(vehicle0lightsalarmdoorsbonnetboot0);
        }
        else return 
SendClientMessage(playeridGREY"This vehicle's engine is already off.");
    }
    else return 
SendClientMessage(playeridGREY"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