Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Don't remove credits
- Filterscript by: Jake Hunter
- Engine starts on press 2
- */
- #define FILTERSCRIPT
- #include <a_samp>
- #define COL_GRESKA "{FF0000}"
- #define COL_RWHITE "{FFFFFF}"
- #define COL_INFO "{37F906}"
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD3 0xCBCCCEFF
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_GRAD6 0xF0F0F0FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_LIGHTRED 0xFF6347AA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_LIGHTGREEN 0x9ACD32AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_YELLOW2 0xF5DEB3AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define COLOR_PURPLE 0xC2A2DAAA
- forward HEngine(playerid,vehicleid);
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- forward ProxDetectorS(Float:radi, playerid, targetid);
- new bool:EngineState[MAX_VEHICLES];
- new Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective;
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Engine System:Jake Hunter");
- print("--------------------------------------\n");
- print(" Engine System:Jake Hunter Loaded....");
- for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
- {
- GetVehicleParamsEx(Vehicles, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- SetVehicleParamsEx(Vehicles, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------------");
- print(" To start the vehicle engine press 2");
- print("----------------------------------------\n");
- }
- #endif
- public HEngine(playerid,vehicleid)
- {
- GetVehicleParamsEx(vehicleid, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- if(EngineState[vehicleid]==false)
- {
- SetVehicleParamsEx(vehicleid, 1, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- new pName[24];
- new string[128];
- GetPlayerName(playerid, pName, 24);
- format(string, 128, "|%s turning the key.", pName);
- format(string, 128, "|%s starts the engine.", pName);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SendClientMessage(playerid, COLOR_WHITE,"Engine is {33AA33}Started!");
- EngineState[vehicleid] = true;
- }
- else
- {
- SetVehicleParamsEx(vehicleid, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- SendClientMessage(playerid, COLOR_WHITE,"Engine is {FF0000}OFF!");
- EngineState[vehicleid] = false;
- }
- }
- public OnVehicleSpawn(vehicleid)
- {
- GetVehicleParamsEx(vehicleid, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- SetVehicleParamsEx(vehicleid, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- EngineState[vehicleid] = false;
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(!ispassenger)
- {
- SetVehicleParamsEx(vehicleid, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
- EngineState[vehicleid] = false;
- SendClientMessage(playerid,COLOR_LIGHTRED,"{37F906}INFO:{FFFFFF}Press 2 to start the engine");
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_SUBMISSION)
- {
- new vehicleid;
- vehicleid = GetPlayerVehicleID(playerid);
- new playerState = GetPlayerState(playerid);
- if (playerState == PLAYER_STATE_DRIVER)
- {
- if(EngineState[vehicleid] == true)
- {
- new pName[24];
- new string[128];
- GetPlayerName(playerid, pName, 24);
- format(string, 128, "|%s disconnect the engine.", pName);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SetTimerEx("HEngine",1,0,"dd",playerid,vehicleid);
- }
- else
- {
- SetTimerEx("HEngine",1,0,"dd",playerid,vehicleid);
- EngineState[vehicleid] = false;
- }
- }
- }
- return 1;
- }
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- else
- {
- SendClientMessage(i, col1, string);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement