Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // [FS] Engine System v1
- // Made by PinkPanter
- // Credits PinkPanter
- #include <a_samp>
- #include <zcmd>
- #define colorRed 0xFF0000FF
- #define colorYellow 0xFFFF00FF
- forward StartEngine(playerid);
- forward DamagedEngine(playerid);
- new vehEngine[MAX_VEHICLES];
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- if(newstate == PLAYER_STATE_DRIVER)
- {
- if(vehEngine[vehicleid] == 0)
- {
- TogglePlayerControllable(playerid, 0);
- SendClientMessage(playerid, colorYellow, "Auto nije upaljeno");
- SendClientMessage(playerid, colorYellow, "Da upali te auto \"Shift\" Ili \"/upali\"");
- }
- else if(vehEngine[vehicleid] == 1)
- {
- TogglePlayerControllable(playerid, 1);
- SendClientMessage(playerid, colorYellow, "Pricekaj te da se upali");
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(vehEngine[vehicleid] == 0)
- {
- if(newkeys == KEY_JUMP)
- {
- vehEngine[vehicleid] = 2;
- SetTimerEx("StartEngine", 3000, 0, "i", playerid);
- SendClientMessage(playerid, colorYellow, "Auto se upalilo");
- }
- }
- if(newkeys == KEY_SECONDARY_ATTACK)
- {
- RemovePlayerFromVehicle(playerid);
- TogglePlayerControllable(playerid, 1);
- }
- }
- return 1;
- }
- public StartEngine(playerid)
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- new Float:health;
- new rand = random(2);
- GetVehicleHealth(vehicleid, health);
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(vehEngine[vehicleid] == 2)
- {
- if(health > 300)
- {
- if(rand == 0)
- {
- vehEngine[vehicleid] = 1;
- TogglePlayerControllable(playerid, 1);
- SetTimerEx("DamagedEngine", 1000, 1, "i", playerid);
- SendClientMessage(playerid, colorYellow, "Auto se upalio");
- }
- if(rand == 1)
- {
- vehEngine[vehicleid] = 0;
- TogglePlayerControllable(playerid, 0);
- SendClientMessage(playerid, colorYellow, "Auto se nije upalio pokusaj ponovo");
- }
- }
- else
- {
- vehEngine[vehicleid] = 0;
- TogglePlayerControllable(playerid, 0);
- SendClientMessage(playerid, colorYellow, "Auto nije se upalio previse osteceno");
- }
- }
- }
- return 1;
- }
- public DamagedEngine(playerid)
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- new Float:health;
- GetVehicleHealth(vehicleid, health);
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(vehEngine[vehicleid] == 1)
- {
- if(health < 300)
- {
- vehEngine[vehicleid] = 0;
- TogglePlayerControllable(playerid, 0);
- SendClientMessage(playerid, colorYellow, "Auto se ugasio previse ostecen");
- }
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- CMD:upali(playerid, params[])
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, colorRed, "PinkPanter FS");
- if(vehEngine[vehicleid] == 0)
- {
- vehEngine[vehicleid] = 2;
- SetTimerEx("StartEngine", 3000, 0, "i", playerid);
- SendClientMessage(playerid, colorYellow, "Pricekaj te da se upali");
- }
- else if(vehEngine[vehicleid] == 1)
- {
- vehEngine[vehicleid] = 0;
- TogglePlayerControllable(playerid, 0);
- SendClientMessage(playerid, colorYellow, "auto ugaseno");
- SendClientMessage(playerid, colorYellow, "Da upali te auto \"Shift\" Ili \"/upali\"");
- }
- return 1;
- }
- public OnFilterScriptInit()
- {
- print("\n [FS] Engine System v1 by pINKpANTER \n");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement