Help ,EngineSystem..
#1

Hello,I have problem with engine system..When i sit on BMX i must turn engine on...How to remove that..Pls Help..


pawn Код:
if(strcmp(cmd, "/engineon", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(vehid != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
                {
                    GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "{2F991A}Upalio {FFFFFF}si vozilo!");
                    format(string, sizeof(string), "* %s je upalio vozilo.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, 0x00FF00FF, "{E31919}Nisi u vozilu!");
        }
        return 1;
    }
    if(strcmp(cmd, "/engineoff", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(vehid != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[playerid] == 1)
                {
                        GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(vehid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                        EngineStatus[GetPlayerVehicleID(playerid)] = 0;
                        SendClientMessage(playerid, 0xFFFFFFAA, "{E31919}Ugasio {FFFFFF}si vozilo!");
                        format(string, sizeof(string), "* %s je ugasio vozilo.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, 0x00FF00FF, "{E31919}Nisi u vozilu!");
        }
        return 1;
    }
Reply
#2

Quote:
Originally Posted by Danchy
Посмотреть сообщение
Hello,I have problem with engine system..When i sit on BMX i must turn engine on...How to remove that..Pls Help..


pawn Код:
if(strcmp(cmd, "/engineon", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(vehid != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
                {
                    GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "{2F991A}Upalio {FFFFFF}si vozilo!");
                    format(string, sizeof(string), "* %s je upalio vozilo.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, 0x00FF00FF, "{E31919}Nisi u vozilu!");
        }
        return 1;
    }
    if(strcmp(cmd, "/engineoff", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(vehid != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[playerid] == 1)
                {
                        GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(vehid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                        EngineStatus[GetPlayerVehicleID(playerid)] = 0;
                        SendClientMessage(playerid, 0xFFFFFFAA, "{E31919}Ugasio {FFFFFF}si vozilo!");
                        format(string, sizeof(string), "* %s je ugasio vozilo.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, 0x00FF00FF, "{E31919}Nisi u vozilu!");
        }
        return 1;
    }
If im not wrong, there is a function or something that defines if a vehicle is a car or airvehicle boat etc
but i can be wrong
Reply
#3

OK, try replacing for this code:

pawn Код:
if(strcmp(cmd, "/engineon", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleModel(playerid) != 509 || 481 || 510)
        {
            if(vehid != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
                {
                    GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "{2F991A}Upalio {FFFFFF}si vozilo!");
                    format(string, sizeof(string), "* %s je upalio vozilo.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, 0x00FF00FF, "{E31919}Nisi u vozilu!");
        }
        return 1;
    }
    if(strcmp(cmd, "/engineoff", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleModel(playerid) != 509 || 481 || 510)
        {
            if(vehid != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[playerid] == 1)
                {
                        GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(vehid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                        EngineStatus[GetPlayerVehicleID(playerid)] = 0;
                        SendClientMessage(playerid, 0xFFFFFFAA, "{E31919}Ugasio {FFFFFF}si vozilo!");
                        format(string, sizeof(string), "* %s je ugasio vozilo.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, 0x00FF00FF, "{E31919}Nisi u vozilu!");
        }
        return 1;
    }
I just added a function to check player isn't on a bicycle (vehicle model 509, 481 or 510).
Let me know if it worked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)