18.04.2015, 16:27
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.
With that code, it shows OFF when the lights are actually ON. Same for the other way round.
When changed to
it works. But on the wiki it states:
Return Values:
0: Vehicle siren is off
1: Vehicle siren is on
Second bug:
I have to press the sirens twice before it actually detects the sirens as ON. when having :
Under
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");
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");
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 }
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; }
Код:
public OnVehicleSirenStateChange(playerid, vehicleid, newstate) { ToggleELSPanelItem(vehicleid, ELS_PANEL_SIREN); return 1; }