/engine bug
#1

Hello, I am having trouble with my /engine bug. If I leave another cars engine on and then enter another car and do /engine it says "Luis_Foxx turns off the vehicle", instead of "Luis_Foxx turns on the vehicle."..

pawn Код:
CMD:engine(playerid, params[])
{
    new vid = GetPlayerVehicleID(playerid);
    new Message[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not in a vehicle.");
    if(vid != INVALID_VEHICLE_ID)
    {
        if(engine == 0)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
            format(Message, sizeof(Message), "* %s turns on the vehicles engine.", name);
            nearByMessage(playerid, COLOR_PURPLE, Message);
            engine = 1;
        }
        else if(engine == 1)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
            format(Message, sizeof(Message), "* %s turns off the vehicles engine.", name);
            nearByMessage(playerid, COLOR_PURPLE, Message);
            engine = 0;
        }
    }
    return 1;
}
Reply
#2

pawn Код:
new engine[MAX_VEHICLES];

//And use this instead

engine = 1//use the next line instead this one
engine[vid] = 1;
engine[vid] = 0;
Reply
#3

I am already defining engine.

pawn Код:
new                     engine, lights, alarm, doors, bonnet, boot, objective;
Reply
#4

You could try using GetVehicleParamsEx instead of making new's and stuff...
Reply
#5

I already am using it.
Reply
#6

Bump.
Reply
#7

Oh come on..
Reply
#8

put GetVehicleParams above the engine checks.
Reply
#9

Quote:
Originally Posted by SkizzoTrick
Посмотреть сообщение
pawn Код:
new engine[MAX_VEHICLES];

//And use this instead

engine = 1//use the next line instead this one
engine[vid] = 1;
engine[vid] = 0;
he is correct...



engine[MAX_VEHICLES];



put that in there and it WILL work
Reply
#10

What I said is correct also, and better to use.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)