Advertisement
Guest User

ALL credits to Matite

a guest
Oct 26th, 2012
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. //SpeedBoost With Car Fly Nitros by Boom
  2. //Don't Romove the Credits Please
  3. //You can Add it with the credits thanks Enjoy my script
  4.  
  5.  
  6. #include <a_samp>
  7. #define FILTERSCRIPT
  8. #define red 0xF60000AA
  9. #define GREEN 0x21DD00FF
  10. #define PRESSED(%0) \
  11. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  12. #define COLOR_MESSAGE_YELLOW 0xFFDD00AA
  13. //------------------------------------------------------------------------------
  14. new Float:SpeedBoostMultiplier[MAX_PLAYERS];
  15.  
  16. // -----------------------------------------------------------------------------
  17.  
  18. public OnFilterScriptInit()
  19. {
  20. print("\n-------------------------------------------------");
  21. print(" Speed Boost With Car Fly Has been loaded by Boom");
  22. print("-------------------------------------------------\n");
  23.  
  24. for (new i = 0; i < MAX_PLAYERS; i++)
  25. {
  26. if (IsPlayerConnected(i) && !IsPlayerNPC(i))
  27. {
  28. SpeedBoostMultiplier[i] = 3.0;
  29. }
  30. }
  31.  
  32. return 1;
  33. }
  34.  
  35. // -----------------------------------------------------------------------------
  36.  
  37. public OnFilterScriptExit()
  38. {
  39. print("\n------------------------------------------------");
  40. print(" Unloaded SpeedBoost with CarFly By Boom Successfully");
  41. print("------------------------------------------------\n");
  42. return 1;
  43. }
  44.  
  45. // -----------------------------------------------------------------------------
  46.  
  47. public OnPlayerCommandText(playerid, cmdtext[])
  48. {
  49. new cmd[256];
  50. new idx;
  51.  
  52. cmd = strtok(cmdtext, idx);
  53. if (strcmp(cmd, "/SpeedBoostSetup", true) == 0 || strcmp(cmd, "/ssb", true) == 0)
  54. {
  55. new strBoostMultiplier[256];
  56. new strTempString[256];
  57. strBoostMultiplier = strtok(cmdtext, idx);
  58.  
  59. if (!strlen(strBoostMultiplier))
  60. {
  61. return 1;
  62. }
  63.  
  64. if (!IsNumeric2(strBoostMultiplier))
  65. {
  66. return 1;
  67. }
  68.  
  69. new Float:BoostMultiplier = floatstr(strBoostMultiplier);
  70.  
  71. if (BoostMultiplier < 1.0 || BoostMultiplier > 3.0)
  72. {
  73. SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "*** Error: You can just change it for 0.1 to 3.0");
  74. return 1;
  75. }
  76.  
  77. SpeedBoostMultiplier[playerid] = BoostMultiplier;
  78.  
  79. format(strTempString,sizeof(strTempString), "*** You set your speed boost multiplier to %0.2f", SpeedBoostMultiplier[playerid]);
  80. SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);
  81.  
  82. return 1;
  83. }
  84. return 0;
  85. }
  86.  
  87. // -----------------------------------------------------------------------------
  88.  
  89. public OnPlayerConnect(playerid)
  90. {
  91. SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "to use the speedboost press LMB, to use the carfly press + or 2");
  92. // (the previous player may of changed it)
  93. SpeedBoostMultiplier[playerid] = 2.0; //Its 2.0 you can also doing 3.0 and change it
  94. return 1;
  95. }
  96.  
  97. // -----------------------------------------------------------------------------
  98.  
  99. stock strtok(const string[], &index)
  100. {
  101. new length = strlen(string);
  102. while ((index < length) && (string[index] <= ' '))
  103. {
  104. index++;
  105. }
  106.  
  107. new offset = index;
  108. new result[20];
  109. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  110. {
  111. result[index - offset] = string[index];
  112. index++;
  113. }
  114. result[index - offset] = EOS;
  115. return result;
  116. }
  117.  
  118. // -----------------------------------------------------------------------------
  119.  
  120. IsNumeric2(const string[])
  121. {
  122. new length=strlen(string);
  123. if (length==0) return false;
  124. for (new i = 0; i < length; i++)
  125. {
  126. if((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+' && string[i]!='.') // Not a number,'+' or '-' or '.'
  127. || (string[i]=='-' && i!=0) // A '-' but not first char.
  128. || (string[i]=='+' && i!=0) // A '+' but not first char.
  129. ) return false;
  130. }
  131. if (length==1 && (string[0]=='-' || string[0]=='+' || string[0]=='.')) return false;
  132. return true;
  133. }
  134.  
  135. // -----------------------------------------------------------------------------
  136.  
  137. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  138. {
  139. if(newkeys == KEY_CROUCH)
  140. {
  141. if(IsPlayerInAnyVehicle(playerid))
  142. {
  143. {
  144. RepairVehicle(GetPlayerVehicleID(playerid));
  145. }
  146. }
  147. }
  148. if (PRESSED(KEY_FIRE))
  149. {
  150. new
  151. vehicleid = GetPlayerVehicleID(playerid);
  152. if (vehicleid)
  153. {
  154. AddVehicleComponent(vehicleid, 1010);
  155. }
  156. }
  157. if(newkeys & KEY_FIRE && IsPlayerInAnyVehicle(playerid))
  158. {
  159. if(!IsNosVehicle(GetPlayerVehicleID(playerid))) return
  160. AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  161. PlayerPlaySound(playerid, 1133 ,0, 0, 0);
  162. }
  163. if(newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
  164. {
  165. if(IsPlayerInAnyVehicle(playerid))
  166. {
  167. new Float:x, Float:y, Float:z;
  168. GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
  169. SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
  170. }
  171. }
  172. if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  173. {
  174. if (newkeys & KEY_FIRE)
  175. {
  176. new Float:vx, Float:vy, Float:vz;
  177. GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
  178.  
  179. if (floatabs(vx) < 3 && floatabs(vy) < 3 && floatabs(vz) < 3)
  180. {
  181. SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * SpeedBoostMultiplier[playerid], vy * SpeedBoostMultiplier[playerid], vz * SpeedBoostMultiplier[playerid]);
  182. }
  183. return 1;
  184. }
  185. }
  186. return 1;
  187. }
  188. IsNosVehicle(vehicleid)
  189. {
  190. #define NO_NOS_VEHICLES 52
  191.  
  192. new InvalidNosVehicles[NO_NOS_VEHICLES] =
  193. {
  194. 581,523,462,521,463,522,461,448,468,586,417,425,469,487,512,520,563,593,
  195. 509,481,510,472,473,493,520,595,484,430,453,432,476,497,513,533,577,
  196. 452,446,447,454,590,569,537,538,570,449,519,460,488,511,519,548,592
  197. };
  198.  
  199. for(new i = 0; i < NO_NOS_VEHICLES; i++)
  200. {
  201. if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
  202. {
  203. return false;
  204. }
  205. }
  206. return true;
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement