SA-MP Forums Archive
Help ,EngineSystem.. - 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)
+--- Thread: Help ,EngineSystem.. (/showthread.php?tid=297585)



Help ,EngineSystem.. - Danchy - 16.11.2011

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;
    }



Re: Help ,EngineSystem.. - cruising - 16.11.2011

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


Re: Help ,EngineSystem.. - PHudson - 16.11.2011

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.