GetVehicleParamsSirenState(vehicleid) : 2 possible bugs
#1

I've been fiddling around with the new functions for siren state; and I may have came across 2 bugs, or my script is wrong.


First bug:
On and off ids are different to stated ids on the wiki.

Код:
new siren = GetVehicleParamsSirenState(vehicleid);
if(siren) TextDrawSetString(vELSTD[vehicleid][4], "~y~ON");
else TextDrawSetString(vELSTD[vehicleid][4], "OFF");
With that code, it shows OFF when the lights are actually ON. Same for the other way round.

When changed to
Код:
new siren = GetVehicleParamsSirenState(vehicleid);
            if(siren == 0) TextDrawSetString(vELSTD[vehicleid][4], "~y~ON");
            else if(siren == 1) TextDrawSetString(vELSTD[vehicleid][4], "OFF");
it works. But on the wiki it states:

Return Values:
0: Vehicle siren is off
1: Vehicle siren is on

Код:
if(siren)
{
    // Siren is on, do something
}
else
{
    // Siren is off, do something
}
Second bug:

I have to press the sirens twice before it actually detects the sirens as ON. when having :

Код:
stock ToggleELSPanelItem(vehicleid, itemid)
{
    switch(itemid)
    {
        case ELS_PANEL_SIREN:
        {
            new siren = GetVehicleParamsSirenState(vehicleid);
            if(siren == 0) TextDrawSetString(vELSTD[vehicleid][4], "~y~ON");
            else if(siren == 1) TextDrawSetString(vELSTD[vehicleid][4], "OFF");
        }
    }
    return 1;
}
Under
Код:
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
{
    ToggleELSPanelItem(vehicleid, ELS_PANEL_SIREN);
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)