Guest User

Untitled

a guest
Oct 14th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. CMD:engine(playerid,params[])
  2. {
  3. if(IsPlayerConnected(playerid))
  4. {
  5. if(IsPlayerInAnyVehicle(playerid))
  6. {
  7. if(!engineOn[GetPlayerVehicleID(playerid)])
  8. {
  9. if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
  10. {
  11. return 1;
  12. }
  13. new vehicleid = GetPlayerVehicleID(playerid);
  14. if(IsAnOwnableCar(idcar))
  15. {
  16. if(PlayerInfo[playerid][pPcarkey] == idcar) { }
  17. else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
  18. else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
  19. else { return 1; }
  20. }
  21. if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
  22. {
  23. return 1;
  24. }
  25. if(idcar == 59 || idcar == 60)
  26. {
  27. return 1;
  28. }
  29. if(idcar >= 135 && idcar <= 154)
  30. {
  31. if(HireCar[playerid] != idcar)
  32. {
  33. return 1;
  34. }
  35. }
  36. if(IsAPlane(idcar))
  37. {
  38. return 1;
  39. }
  40. if(IsAHarvest(idcar))
  41. {
  42. return 1;
  43. }
  44. if(IsADrugHarvest(idcar))
  45. {
  46. return 1;
  47. }
  48. if(IsASweeper(idcar))
  49. {
  50. return 1;
  51. }
  52. if(gEngine[playerid] == 1) { return 1; }
  53.  
  54. new playerveh = GetPlayerVehicleID(playerid);
  55. new string[256];
  56. PutPlayerInVehicle(playerid, playerveh, 0);
  57. GetPlayerName(playerid, sendername, sizeof(sendername));
  58. format(string, sizeof(string), "* %s spins a key and tries to start vehicle engine.", sendername);
  59. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  60. SetTimerEx("StartingTheVehicle",1500,0,"i",playerid);
  61. GameTextForPlayer(playerid, "~w~Starting vehicle engine...",3500,3);
  62. gEngine[playerid] = 1;
  63. return 1;
  64. }
  65. if(engineOn[GetPlayerVehicleID(playerid)])
  66. {
  67. if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
  68. {
  69. return 1;
  70. }
  71. if(IsAnOwnableCar(idcar))
  72. {
  73. if(PlayerInfo[playerid][pPcarkey] == idcar) { }
  74. else if(PlayerInfo[playerid][pPcarkey2] == idcar) { }
  75. else if(PlayerInfo[playerid][pPcarkey3] == idcar) { }
  76. else { return 1; }
  77. }
  78. if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
  79. {
  80. return 1;
  81. }
  82. if(idcar == 59 || idcar == 60)
  83. {
  84. return 1;
  85. }
  86. if(idcar >= 135 && idcar <= 154)
  87. {
  88. if(HireCar[playerid] != idcar)
  89. {
  90. return 1;
  91. }
  92. }
  93. if(IsAHarvest(idcar))
  94. {
  95. return 1;
  96. }
  97. if(IsADrugHarvest(idcar))
  98. {
  99. return 1;
  100. }
  101. if(IsAPlane(idcar))
  102. {
  103. return 1;
  104. }
  105. if(IsASweeper(idcar))
  106. {
  107. return 1;
  108. }
  109. engineOn[GetPlayerVehicleID(playerid)] = false;
  110. //RemovePlayerFromVehicle(playerid);
  111. TogglePlayerControllable(playerid, 0);
  112. GetPlayerName(playerid, sendername, sizeof(sendername));
  113. format(string, sizeof(string), "* %s spins the vehicle key and turns off the engine.", sendername);
  114. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  115. gEngine[playerid] = 0;
  116. /* new keycar = PlayerInfo[playerid][pPcarkey];
  117. new keycar2 = PlayerInfo[playerid][pPcarkey2];
  118. new keycar3 = PlayerInfo[playerid][pPcarkey3];
  119. if(IsAnOwnableCar(idcar))
  120. {
  121. if(keycar == idcar)
  122. {
  123. for(new i = 0; i < MAX_PLAYERS; i++)
  124. {
  125. if (IsPlayerConnected(i))
  126. {
  127. SetVehicleParamsForPlayer(keycar,i,0,1);
  128. }
  129. GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
  130. CarInfo[keycar][cLock] = 1;
  131. }
  132. }
  133. else if(keycar2 == idcar)
  134. {
  135. for(new i = 0; i < MAX_PLAYERS; i++)
  136. {
  137. if (IsPlayerConnected(i))
  138. {
  139. SetVehicleParamsForPlayer(keycar2,i,0,1);
  140. }
  141. GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
  142. CarInfo[keycar2][cLock] = 1;
  143. }
  144. }
  145. else if(keycar3 == idcar)
  146. {
  147. for(new i = 0; i < MAX_PLAYERS; i++)
  148. {
  149. if (IsPlayerConnected(i))
  150. {
  151. SetVehicleParamsForPlayer(keycar3,i,0,1);
  152. }
  153. GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
  154. CarInfo[keycar3][cLock] = 1;
  155. }
  156. }
  157. }*/
  158. return 1;
  159. }
  160. }
  161. }
  162. return 1;
  163. }
Advertisement
Add Comment
Please, Sign In to add comment