Vehicle engine problem
#1

I was create a new function for a vehicle engine

pawn Код:
forward SetVehicleEngine(vehicleid, status);
public SetVehicleEngine(vehicleid, status)
{
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, status, lights, alarm, doors, bonnet, boot, objective);
    vInfo[vehicleid][vEngine] = status;
    return 1;
}
When I compile, its not showing a error but when I try in my server.. it doesnt work. How to fix it
Reply
#2

You better use,
pawn Код:
public SetVehicleEngine(playerid, status){
new vehicleid = GetPlayerVehicleID(playerid);
//...rest of the code.
}
Reply
#3

Quote:
Originally Posted by Bogdan1992
Посмотреть сообщение
You better use,
pawn Код:
public SetVehicleEngine(playerid, status){
new vehicleid = GetPlayerVehicleID(playerid);
//...rest of the code.
}
I has use your function.. but its still not working

I try with OnPlayerUpdate

pawn Код:
stock GetVehicleEngine(vehicleid) return vInfo[vehicleid][vEngine];

public OnPlayerUpdate(playerid)
{
    new Keys,ud,lr;
    GetPlayerKeys(playerid,Keys,ud,lr);
    if(IsPlayerInAnyVehicle(playerid))
    {
        new v = GetPlayerVehicleID(playerid);
        if(Keys == KEY_FIRE)
        {
            if(GetVehicleEngine(v) != 1)
            {
                new rand = random(2);
                SetVehicleEngine(playerid, rand);
                if(rand == 1)
                {
                    SendClientMessage(playerid, Green2, "Engine on, ");
                }
                else
                {
                    SendClientMessage(playerid, Red, "Busy, try again");
                }
                return 1;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)