Advertisement
Guest User

Engine System - By Claude

a guest
Aug 20th, 2010
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define COLOR_PURPLE 0xBA84D1FF
  4. #define COLOR_RED 0xFA0000FF
  5. #define COLOR_YELLOW 0xFFFF00FF
  6.  
  7. public OnFilterScriptInit()
  8. {
  9. print("¥ > Engine Starter loaded by Claude < ¥");
  10. }
  11.  
  12. public OnFilterScriptExit()
  13. {
  14. print("¥ > Engine Starter unloaded by Claude < ¥");
  15. }
  16.  
  17. new Engine[MAX_PLAYERS];
  18.  
  19. forward EngineStart(playerid);
  20.  
  21. public OnPlayerConnect(playerid)
  22. {
  23. SendClientMessage(playerid, COLOR_YELLOW,"This server is using the engine system made by Claude");
  24. Engine[playerid] = 0;
  25. return 1;
  26. }
  27.  
  28. public OnPlayerCommandText(playerid, cmdtext[])
  29. {
  30. if (strcmp(cmdtext, "/engine", true) == 0)
  31. {
  32. new Float:veh_health;
  33. GetVehicleHealth(playerid, veh_health);
  34. if(veh_health <= 400) return SendClientMessage(playerid, COLOR_RED,"Your engine is to much damaged to start it, please repair it");
  35. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You can't start an engine if you are not in a vehicle!");
  36. SendClientMessage(playerid, COLOR_PURPLE,"You twist the key, and wait 3 seconds");
  37. SetTimerEx("EngineStart", 3000, false, "d", playerid);
  38. return 1;
  39. }
  40. return 0;
  41. }
  42.  
  43. public EngineStart(playerid)
  44. {
  45. switch(random(2))
  46. {
  47. case 1: Engine[playerid] = 1, SendClientMessage(playerid, COLOR_YELLOW,"Engine is succesfully started"), TogglePlayerControllable(playerid, 1);
  48. case 2: Engine[playerid] = 0, SendClientMessage(playerid, COLOR_YELLOW,"Engine failed to start, please try again"), TogglePlayerControllable(playerid, 0);
  49. }
  50. return 1;
  51. }
  52.  
  53. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  54. {
  55. TogglePlayerControllable(playerid, 0);
  56. GameTextForPlayer(playerid, "~g~Engine is not started!~n~r~Use /engine to start it", 3000, 4);
  57. return 1;
  58. }
  59.  
  60. public OnPlayerExitVehicle(playerid, vehicleid)
  61. {
  62. Engine[playerid] = 0;
  63. return 1;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement