18.04.2015, 00:15
On my server I made vehicles' lights automatically come on when the siren is enabled through OnVehicleSirenStateChange, however it seems this causes an infinite loop of the siren being toggled on/off.
Here's a video showing what happens (have audio on):
[ame]http://www.youtube.com/watch?v=e248PV9Dts4[/ame]
I tested this is a BLANK script, which is this:
You spawn, get in the cop car, toggle the siren on, and it's stuck. All it's doing is turning the lights on or off, depending on 'newstate'.
It can be fixed by setting a timer (even if just 1 MS). I guess SetVehicleParamsEx is conflicting internally. Perhaps 'sirenstate' could actually be added to SetVehicleParamsEx to allow scripted control over sirens?
Here's a video showing what happens (have audio on):
[ame]http://www.youtube.com/watch?v=e248PV9Dts4[/ame]
I tested this is a BLANK script, which is this:
pawn Код:
#include <a_samp>
main() {}
public OnGameModeInit()
{
AddPlayerClass(0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
CreateVehicle(596, 3, 3, 3, 0, -1, -1, -1);
return 1;
}
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, newstate, alarm, doors, bonnet, boot, objective);
return 1;
}
It can be fixed by setting a timer (even if just 1 MS). I guess SetVehicleParamsEx is conflicting internally. Perhaps 'sirenstate' could actually be added to SetVehicleParamsEx to allow scripted control over sirens?