[BUG] OnVehicleSirenStateChange caught in infinite loop
#1

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:

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


Messages In This Thread
[BUG] OnVehicleSirenStateChange caught in infinite loop - by MP2 - 18.04.2015, 00:15
Re: [BUG] OnVehicleSirenStateChange caught in infinite loop - by Mmartin - 18.04.2015, 15:27
Re: [BUG] OnVehicleSirenStateChange caught in infinite loop - by Kalcor - 18.04.2015, 15:51
Re: [BUG] OnVehicleSirenStateChange caught in infinite loop - by MP2 - 18.04.2015, 16:56

Forum Jump:


Users browsing this thread: 1 Guest(s)