new siren = GetVehicleParamsSirenState(vehicleid); if(siren) TextDrawSetString(vELSTD[vehicleid][4], "~y~ON"); else TextDrawSetString(vELSTD[vehicleid][4], "OFF");
new siren = GetVehicleParamsSirenState(vehicleid);
if(siren == 0) TextDrawSetString(vELSTD[vehicleid][4], "~y~ON");
else if(siren == 1) TextDrawSetString(vELSTD[vehicleid][4], "OFF");
if(siren)
{
// Siren is on, do something
}
else
{
// Siren is off, do something
}
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;
}
|
The wiki is wrong at this point. Anything involving "VehicleParams" has three values: VEHICLE_PARAMS_UNSET = -1, VEHICLE_PARAMS_OFF = 0, VEHICLE_PARAMS_ON = 1.
|
|
The wiki is wrong at this point. Anything involving "VehicleParams" has three values: VEHICLE_PARAMS_UNSET = -1, VEHICLE_PARAMS_OFF = 0, VEHICLE_PARAMS_ON = 1.
|
|
What about the second report, why do I have to enable the sirens for the second time for it to detect as the vehicle sirens on?
|
stock ToggleELSPanelItem(vehicleid, itemid, togglestate)
...
if(togglestate == VEHICLE_PARAMS_ON) TextDrawSetString(vELSTD[vehicleid][4], "~y~ON");
else TextDrawSetString(vELSTD[vehicleid][4], "OFF");
...
ToggleELSPanelItem(vehicleid, ELS_PANEL_SIREN, newstate);