Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define COLOR_PURPLE 0xBA84D1FF
- #define COLOR_RED 0xFA0000FF
- #define COLOR_YELLOW 0xFFFF00FF
- public OnFilterScriptInit()
- {
- print("¥ > Engine Starter loaded by Claude < ¥");
- }
- public OnFilterScriptExit()
- {
- print("¥ > Engine Starter unloaded by Claude < ¥");
- }
- new Engine[MAX_PLAYERS];
- forward EngineStart(playerid);
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid, COLOR_YELLOW,"This server is using the engine system made by Claude");
- Engine[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp(cmdtext, "/engine", true) == 0)
- {
- new Float:veh_health;
- GetVehicleHealth(playerid, veh_health);
- if(veh_health <= 400) return SendClientMessage(playerid, COLOR_RED,"Your engine is to much damaged to start it, please repair it");
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You can't start an engine if you are not in a vehicle!");
- SendClientMessage(playerid, COLOR_PURPLE,"You twist the key, and wait 3 seconds");
- SetTimerEx("EngineStart", 3000, false, "d", playerid);
- return 1;
- }
- return 0;
- }
- public EngineStart(playerid)
- {
- switch(random(2))
- {
- case 1: Engine[playerid] = 1, SendClientMessage(playerid, COLOR_YELLOW,"Engine is succesfully started"), TogglePlayerControllable(playerid, 1);
- case 2: Engine[playerid] = 0, SendClientMessage(playerid, COLOR_YELLOW,"Engine failed to start, please try again"), TogglePlayerControllable(playerid, 0);
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- TogglePlayerControllable(playerid, 0);
- GameTextForPlayer(playerid, "~g~Engine is not started!~n~r~Use /engine to start it", 3000, 4);
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- Engine[playerid] = 0;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement