19.08.2014, 12:32
Hello there!
I have an issue with this script.
When I attempt to use it, it comes up saying that it both turns it off and on at the same time...
And then of course when they spawned, I put them to zero.
Even though it still happens. Any ideas?
I have an issue with this script.
When I attempt to use it, it comes up saying that it both turns it off and on at the same time...
pawn Код:
COMMAND:elm(playerid, params[])
{
new string[256], msg[200], vehicleid = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][pFaction] == 1 || PlayerInfo[playerid][pFaction] == 2)
{
new vehicle = GetPlayerVehicleID(playerid);
if(VehicleInfo[vehicle][vFaction] != 1 && VehicleInfo[vehicle][vFaction] != 2) return SendClientMessage(playerid, COLOR_GREY, "This vehicle does not have a emergency light.");
if(Flasher[vehicle] == 1)
{
Flasher[vehicle] = 0;
new enginee, lights, alarm, doors, bonnet, boot, objective;
SendClientMessage(playerid, -1, "You switched off the lights.");
GetVehicleParamsEx(vehicleid, enginee, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, enginee, 0, alarm, doors, bonnet, boot, objective);
format(string, sizeof(string), "* %s turns on the Emergency Lights of the vehicle. *", GetNameWithSpace(playerid));
ProxDetector(12, playerid, msg, COLOR_PINK);
new panelsx, doorsx, lightsx, tiresx, lightsxx = encode_lights(0, 0, 0, 0);
GetVehicleDamageStatus(vehicleid,panelsx,doorsx,lightsx,tiresx);
UpdateVehicleDamageStatus(vehicleid, panelsx, doorsx, lightsxx, tiresx);
}
else
{
Flasher[vehicle] = 1;
new enginee, lights, alarm, doors, bonnet, boot, objective;
SendClientMessage(playerid, -1, "You have turned on the emergency lights in this vehicle.");
GetVehicleParamsEx(vehicle, enginee, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicle, enginee, 1, alarm, doors, bonnet, boot, objective);
format(string, sizeof(string), "** %s turns on the Emergency Lights of the vehicle. **", GetNameWithSpace(playerid, 1));
ProxDetector(12, playerid, msg, COLOR_PINK);
}
}
return 1;
}
pawn Код:
public FlasherFunc()
{
new panelsx, doorsx, lightsx, tiresx;
for(new p=0; p<MAX_VEHICLES; p++)
{
if(Flasher[p] == 1)
{
if (FlasherState[p] == 1)
{
GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,tiresx);
UpdateVehicleDamageStatus(p, panelsx, doorsx, 4, tiresx);
FlasherState[p] = 0;
}
else
{
GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,tiresx);
UpdateVehicleDamageStatus(p, panelsx, doorsx, 1, tiresx);
FlasherState[p] = 1;
}
}
}
return 1;
}
encode_lights(light1, light2, light3, light4)
{
return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}
pawn Код:
new Flasher[MAX_VEHICLES];
new FlasherState[MAX_VEHICLES];
Even though it still happens. Any ideas?