12.03.2017, 20:24
Well , alot of problems i have lol
I tried to make kinda of turn signals system but it's not working so well
OnPlayerKeyStateChange:
Timers:
It's not stoping and when i press to activate the right one its activating the left one...And the right one it's never stops
I tried to make kinda of turn signals system but it's not working so well
OnPlayerKeyStateChange:
PHP код:
if(PRESSED(KEY_LOOK_RIGHT))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid, vehicleid))
{
if(!IsVehicleAirVehicleEx(vehicleid))
{
FlashTimerR[vehicleid] = SetTimerEx("FlashLightR", 120, true,"i",vehicleid);
DestroyFlashTimerR[vehicleid] = SetTimerEx("DestroyFlashLightR", 700, false,"i",vehicleid);
}
}
}
if(PRESSED(KEY_LOOK_LEFT))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid, vehicleid))
{
if(!IsVehicleAirVehicleEx(vehicleid))
{
FlashTimerL[vehicleid] = SetTimerEx("FlashLightL", 120, true,"i",vehicleid);
DestroyFlashTimerL[vehicleid] = SetTimerEx("DestroyFlashLightL", 700, false,"i",vehicleid);
}
}
}
PHP код:
forward FlashLightR(vehicleid);
public FlashLightR(vehicleid)
{
new panels,doors,lights,tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
if(lights == 1)
{
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
lights = 5;
}
else if(lights == 5)
{
UpdateVehicleDamageStatus(vehicleid, panels, doors, 1, tires);
lights = 1;
}
return 1;
}
forward DestroyFlashLightR(vehicleid);
public DestroyFlashLightR(vehicleid)
{
new panels,doors,lights,tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
KillTimer(FlashTimerR[vehicleid]);
return 1;
}
forward FlashLightL(vehicleid);
public FlashLightL(vehicleid)
{
new panels,doors,lights,tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
if(lights == 4)
{
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
lights = 5;
}
else if(lights == 5)
{
UpdateVehicleDamageStatus(vehicleid, panels, doors, 4, tires);
lights = 4;
}
return 1;
}
forward DestroyFlashLightL(vehicleid);
public DestroyFlashLightL(vehicleid)
{
new panels,doors,lights,tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
KillTimer(DestroyFlashTimerL[vehicleid]);
return 1;
}