Engine problems.
#1

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

Probably it's not off?
Reply
#3

Your engine script?
Reply
#4

show the code?
Reply
#5

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

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

GTA enables it when you enter..?

Disable it on enter.
Reply
#8

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

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

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

Disable it on enter.
^^^^
Reply
#11

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

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

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?
Reply
#14

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]);
}
Reply
#15

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


Forum Jump:


Users browsing this thread: