Advertisement
Guest User

Untitled

a guest
Jul 27th, 2018
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. // [FS] Engine System v1
  2. // Made by PinkPanter
  3. // Credits PinkPanter
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7.  
  8. #define colorRed 0xFF0000FF
  9. #define colorYellow 0xFFFF00FF
  10.  
  11. forward StartEngine(playerid);
  12. forward DamagedEngine(playerid);
  13.  
  14. new vehEngine[MAX_VEHICLES];
  15.  
  16. public OnPlayerStateChange(playerid, newstate, oldstate)
  17. {
  18. new vehicleid = GetPlayerVehicleID(playerid);
  19.  
  20. if(newstate == PLAYER_STATE_DRIVER)
  21. {
  22. if(vehEngine[vehicleid] == 0)
  23. {
  24. TogglePlayerControllable(playerid, 0);
  25. SendClientMessage(playerid, colorYellow, "Auto nije upaljeno");
  26. SendClientMessage(playerid, colorYellow, "Da upali te auto \"Shift\" Ili \"/upali\"");
  27. }
  28. else if(vehEngine[vehicleid] == 1)
  29. {
  30. TogglePlayerControllable(playerid, 1);
  31. SendClientMessage(playerid, colorYellow, "Pricekaj te da se upali");
  32. }
  33. }
  34. return 1;
  35. }
  36.  
  37. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  38. {
  39. new vehicleid = GetPlayerVehicleID(playerid);
  40.  
  41. if(IsPlayerInAnyVehicle(playerid))
  42. {
  43. if(vehEngine[vehicleid] == 0)
  44. {
  45. if(newkeys == KEY_JUMP)
  46. {
  47. vehEngine[vehicleid] = 2;
  48. SetTimerEx("StartEngine", 3000, 0, "i", playerid);
  49. SendClientMessage(playerid, colorYellow, "Auto se upalilo");
  50. }
  51. }
  52. if(newkeys == KEY_SECONDARY_ATTACK)
  53. {
  54. RemovePlayerFromVehicle(playerid);
  55. TogglePlayerControllable(playerid, 1);
  56. }
  57. }
  58. return 1;
  59. }
  60.  
  61. public StartEngine(playerid)
  62. {
  63. new vehicleid = GetPlayerVehicleID(playerid);
  64. new Float:health;
  65. new rand = random(2);
  66.  
  67. GetVehicleHealth(vehicleid, health);
  68.  
  69. if(IsPlayerInAnyVehicle(playerid))
  70. {
  71. if(vehEngine[vehicleid] == 2)
  72. {
  73. if(health > 300)
  74. {
  75. if(rand == 0)
  76. {
  77. vehEngine[vehicleid] = 1;
  78. TogglePlayerControllable(playerid, 1);
  79. SetTimerEx("DamagedEngine", 1000, 1, "i", playerid);
  80. SendClientMessage(playerid, colorYellow, "Auto se upalio");
  81. }
  82. if(rand == 1)
  83. {
  84. vehEngine[vehicleid] = 0;
  85. TogglePlayerControllable(playerid, 0);
  86. SendClientMessage(playerid, colorYellow, "Auto se nije upalio pokusaj ponovo");
  87. }
  88. }
  89. else
  90. {
  91. vehEngine[vehicleid] = 0;
  92. TogglePlayerControllable(playerid, 0);
  93. SendClientMessage(playerid, colorYellow, "Auto nije se upalio previse osteceno");
  94. }
  95. }
  96. }
  97. return 1;
  98. }
  99.  
  100. public DamagedEngine(playerid)
  101. {
  102. new vehicleid = GetPlayerVehicleID(playerid);
  103. new Float:health;
  104.  
  105. GetVehicleHealth(vehicleid, health);
  106.  
  107. if(IsPlayerInAnyVehicle(playerid))
  108. {
  109. if(vehEngine[vehicleid] == 1)
  110. {
  111. if(health < 300)
  112. {
  113. vehEngine[vehicleid] = 0;
  114. TogglePlayerControllable(playerid, 0);
  115. SendClientMessage(playerid, colorYellow, "Auto se ugasio previse ostecen");
  116. }
  117. }
  118. }
  119. return 1;
  120. }
  121.  
  122. public OnPlayerExitVehicle(playerid, vehicleid)
  123. {
  124. TogglePlayerControllable(playerid, 1);
  125. return 1;
  126. }
  127.  
  128. CMD:upali(playerid, params[])
  129. {
  130. new vehicleid = GetPlayerVehicleID(playerid);
  131.  
  132. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, colorRed, "PinkPanter FS");
  133.  
  134. if(vehEngine[vehicleid] == 0)
  135. {
  136. vehEngine[vehicleid] = 2;
  137. SetTimerEx("StartEngine", 3000, 0, "i", playerid);
  138. SendClientMessage(playerid, colorYellow, "Pricekaj te da se upali");
  139. }
  140. else if(vehEngine[vehicleid] == 1)
  141. {
  142. vehEngine[vehicleid] = 0;
  143. TogglePlayerControllable(playerid, 0);
  144. SendClientMessage(playerid, colorYellow, "auto ugaseno");
  145. SendClientMessage(playerid, colorYellow, "Da upali te auto \"Shift\" Ili \"/upali\"");
  146. }
  147. return 1;
  148. }
  149.  
  150. public OnFilterScriptInit()
  151. {
  152. print("\n [FS] Engine System v1 by pINKpANTER \n");
  153. return 1;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement