Engine help.
#1

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;
Reply
#2

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;

Reply
#3

I got that jsut with ZCMD..?
Reply
#4

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

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

Why don't you set the vehicle engine to false by using SetVehicleParamsEx?
Reply
#7

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

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);
Reply
#9

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

Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)