-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
News
Documentation
Posts posted by icelol
-
-
Salut ! Am codul acesta ... functioneaza bine , dar cand tin apasat pe D sau A semnalizeaza din faruri
#include <a_samp> #define BLINK_RATE 500 // This is the rate of flash (also rate of timer in milliseconds) #define LIGHT_KEY KEY_SUBMISSION // Set this to whatever key you want to turn the lights on //Put MAX PLAYERS HERE (sorry its for the timer..) #undef MAX_PLAYERS #define MAX_PLAYERS 50 // Macro from SAMP wiki Credits to the author #define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) new BlinkTime[MAX_PLAYERS]; public OnPlayerDisconnect(playerid, reason) { KillTimer(BlinkTime[playerid]); return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new panels, doors, lights, tires; GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires); lights = encode_lights(1, 1, 1, 1); SetPVarInt(playerid, "vMainOn", 0); UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires); BlinkTime[playerid] = SetTimerEx("vBlinker", BLINK_RATE, 1, "i", playerid); } else if(newstate == PLAYER_STATE_ONFOOT) { KillTimer(BlinkTime[playerid]); } return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(PRESSED(LIGHT_KEY)) { new panels, doors, lights, tires; GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires); switch(GetPVarInt(playerid, "vMainOn")) { case 0: { lights = encode_lights(0, 0, 0, 0); SetPVarInt(playerid, "vMainOn", 1); } case 1: { lights = encode_lights(1, 1, 1, 1); SetPVarInt(playerid, "vMainOn", 0); } } UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires); } return 1; } forward vBlinker(playerid); public vBlinker(playerid) { if(IsPlayerInAnyVehicle(playerid)) { new Keys, ud, lr, panels, doors, lights, tires; GetPlayerKeys(playerid, Keys, ud, lr); GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires); if(lr > 0) { switch(GetPVarInt(playerid, "vMainOn")){ case 0:{ switch(GetPVarInt(playerid, "vBlinkOn")){ case 0:{ lights = encode_lights(1, 1, 0, 0); SetPVarInt(playerid, "vBlinkOn", 1); } case 1:{ lights = encode_lights(1, 1, 1, 1); SetPVarInt(playerid, "vBlinkOn", 0); } } } case 1:{ switch(GetPVarInt(playerid, "vBlinkOn")){ case 0:{ lights = encode_lights(0, 0, 1, 1); SetPVarInt(playerid, "vBlinkOn", 1); } case 1:{ lights = encode_lights(0, 0, 0, 0); SetPVarInt(playerid, "vBlinkOn", 0); } } } } } else if(lr < 0) { switch(GetPVarInt(playerid, "vMainOn")){ case 0:{ switch(GetPVarInt(playerid, "vBlinkOn")){ case 0:{ lights = encode_lights(0, 0, 1, 1); SetPVarInt(playerid, "vBlinkOn", 1); } case 1:{ lights = encode_lights(1, 1, 1, 1); SetPVarInt(playerid, "vBlinkOn", 0); } } } case 1:{ switch(GetPVarInt(playerid, "vBlinkOn")){ case 0:{ lights = encode_lights(1, 1, 0, 0); SetPVarInt(playerid, "vBlinkOn", 1); } case 1:{ lights = encode_lights(0, 0, 0, 0); SetPVarInt(playerid, "vBlinkOn", 0); } } } } }else if(lr == 0) { switch(GetPVarInt(playerid, "vMainOn")){ case 0:{ lights = encode_lights(1, 1, 1, 1); } case 1:{ lights = encode_lights(0, 0, 0, 0); } } } UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires); } return 1; } // Thanks to JernejL (RedShirt) encode_lights(light1, light2, light3, light4) { return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3); }
Ce trebuie sa scot din cod sa nu mai semnalizeze de loc si sa se aprinda luminile si ziua ?
Multumesc !
[FS]Controlul masinii [0.3c]
in Filterscript-uri
Posted
Va rog !! :-[