SA-MP Forums Archive
Engine problems. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Engine problems. (/showthread.php?tid=277969)



Engine problems. - budelis - 20.08.2011

Hi all.I have problem with my car engine.When engine off,and i out of car,and sit again,engine on.Why?


Re: Engine problems. - Kush - 20.08.2011

Probably it's not off?


Re: Engine problems. - wouter0100 - 20.08.2011

Your engine script?


Re: Engine problems. - Newbie - 20.08.2011

show the code?


Re: Engine problems. - Kyle_Olsen - 20.08.2011

Are you sure you have put
pawn Code:
ManualVehicleEngineAndLights();
Under OnGameModeInit ?


Re: Engine problems. - wouter0100 - 20.08.2011

Thats not need, you can controll Engine and lights when you dont put that in GamemodeInit then are the lights and engine on.


Re: Engine problems. - MP2 - 20.08.2011

GTA enables it when you enter..?

Disable it on enter.


Re: Engine problems. - =WoR=G4M3Ov3r - 20.08.2011

You can't expect people to help ya without some Details


Re: Engine problems. - MP2 - 20.08.2011

No details are needed, it's a simple problem with a simple solution.


Re: Engine problems. - MP2 - 20.08.2011

Quote:
Originally Posted by MP2
View Post
GTA enables it when you enter..?

Disable it on enter.
^^^^


Re: Engine problems. - Basicz - 20.08.2011

Bad idea,
pawn Код:
new
    bool: vEngine[ MAX_VEHICLES char ] // Limited to 255 ( 8bits ), well this time we'll use only true(1) and false(0).
;

public OnVehicleSpawn( vehicleid )
{
    vEngine[ vehicleid ] = false;

    return 1;
}

COMMAND:engine(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
if ( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, -1, "Not in any veh" );
new veh = GetPlayerVehicleID(playerid);
if( !vEngine[ veh ]  )
{
GetVehicleParamsEx(veh,engine,lightsp,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lightsp,alarm,doors,bonnet,boot,objective);
vEngine[ veh ] = vEngine[ veh ];
GameTextForPlayer(playerid,"~r~Engine on", 3000, 5);
}
else
{
GetVehicleParamsEx(veh,engine,lightsp,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lightsp,alarm,doors,bonnet,boot,objective);
vEngine[ veh ] = !vEngine[ veh ];
GameTextForPlayer(playerid,"~r~Engine off", 3000, 5);
}
return 1;
}
The simple way


Re: Engine problems. - wouter0100 - 20.08.2011

pawn Код:
COMMAND:engine(playerid, params[])
{
    new veh = GetPlayerVehicleID(playerid),
        engine,
        light,
        alarm,
        doors,
        bonnet,
        boot,
        objective;

    GetVehicleParamsEx(veh,engine,light,alarm,doors,bonnet,boot,objective);
    if(engine){
        SetVehicleParamsEx(veh,false,light,alarm,doors,bonnet,boot,objective);
    }else{
        SetVehicleParamsEx(veh,true,light,alarm,doors,bonnet,boot,objective);
    }
}



Re: Engine problems. - budelis - 21.08.2011

What is wrong here?

Код:
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetPVarInt(playerid, "Engine") == 0)
{
SendClientMessage(playerid,COLOR_GREEN,"Work");
GetVehicleParamsEx(vehicleid,engine,lightst,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lightst,alarm,doors,bonnet,boot,objective);
}
Why,when i sit to vehicle,i get message "Work" but my vehicle engine not off why?


Re: Engine problems. - wouter0100 - 21.08.2011

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetPVarInt(playerid, "Engine") == 0)
{
SendClientMessage(playerid,COLOR_GREEN,"Work");
new vehparams[6];
GetVehicleParamsEx(vehicleid,vehparams[0],vehparams[1],vehparams[2],vehparams[3],vehparams[4],vehparams[5],vehparams[6]);
SetVehicleParamsEx(vehicleid,false,vehparams[1],vehparams[2],vehparams[3],vehparams[4],vehparams[5],vehparams[6]);
}



Re: Engine problems. - budelis - 21.08.2011

C:\Documents and Settings\Owner\Desktop\NAUJAUSIAS SAMP SERVERIS\gamemodes\SF.pwn(4111) : error 032: array index out of bounds (variable "vehparams")
C:\Documents and Settings\Owner\Desktop\NAUJAUSIAS SAMP SERVERIS\gamemodes\SF.pwn(4112) : error 032: array index out of bounds (variable "vehparams")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.