Guest User

Auto-Pilotas

a guest
Apr 10th, 2011
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.73 KB | None | 0 0
  1. //PAMOKA KURTA "Audriuslion"
  2. //PRAŠOME NEKOPIJUOTI KREDITU!!!
  3. //==============================================================================
  4. #include <a_samp>
  5.  
  6. #if defined FILTERSCRIPT
  7.  
  8. public OnFilterScriptInit()
  9. {
  10. print("\n--------------------------------------");
  11. print(" Blank Filterscript by your name here");
  12. print("--------------------------------------\n");
  13. return 1;
  14. }
  15.  
  16. public OnFilterScriptExit()
  17. {
  18. return 1;
  19. }
  20.  
  21. #else
  22.  
  23. main()
  24. {
  25. print("\n----------------------------------");
  26. print(" Blank Gamemode by your name here");
  27. print("----------------------------------\n");
  28. }
  29.  
  30. #endif
  31. //===============================AutoPilotas====================================
  32. forward SetPlayerSpeedCap( playerid, Float:value );
  33. forward DisablePlayerSpeedCap( playerid );
  34. new
  35. Float:g_fSpeedCap[ MAX_PLAYERS ] = { 0.0, ... }
  36. ;
  37. new
  38. bool:GreicioMatvaimas[ MAX_PLAYERS ]
  39. ;
  40. //==============================================================================
  41. public OnGameModeInit()
  42. {
  43. // Don't use these lines if it's a filterscript
  44. SetGameModeText("Blank Script");
  45. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  46. return 1;
  47. }
  48.  
  49. public OnGameModeExit()
  50. {
  51. return 1;
  52. }
  53.  
  54. public OnPlayerRequestClass(playerid, classid)
  55. {
  56. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  57. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  58. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  59. return 1;
  60. }
  61.  
  62. public OnPlayerConnect(playerid)
  63. {
  64. return 1;
  65. }
  66.  
  67. public OnPlayerDisconnect(playerid, reason)
  68. {
  69. return 1;
  70. }
  71.  
  72. public OnPlayerSpawn(playerid)
  73. {
  74. return 1;
  75. }
  76.  
  77. public OnPlayerDeath(playerid, killerid, reason)
  78. {
  79. return 1;
  80. }
  81.  
  82. public OnVehicleSpawn(vehicleid)
  83. {
  84. return 1;
  85. }
  86.  
  87. public OnVehicleDeath(vehicleid, killerid)
  88. {
  89. return 1;
  90. }
  91.  
  92. public OnPlayerText(playerid, text[])
  93. {
  94. return 1;
  95. }
  96.  
  97. public OnPlayerCommandText(playerid, cmdtext[])
  98. {
  99. if(strcmp(cmdtext, "/autopilotas", true) == 0 )
  100. {
  101. if( GreicioMatvaimas[ playerid ] == false )
  102. {
  103. GreicioMatvaimas[ playerid ] = true;
  104.  
  105. SetPlayerSpeedCap( playerid, 0.5 );//Pasikeisk į norimą.Ir po OnPlayerEnterVehicle pakeisk į tokį patį kokį čia.
  106.  
  107. SendClientMessage(playerid, 0xAA3333AA, "Ribotuvas Ijunktas");
  108. }
  109. else
  110. {
  111. GreicioMatvaimas[ playerid ] = false;
  112.  
  113. DisablePlayerSpeedCap( playerid );
  114.  
  115. SendClientMessage(playerid, 0xAA3333AA, "Ribotuvas Isiunktas");
  116. }
  117. return true;
  118. }
  119. return 1;
  120. }
  121. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  122. {
  123. if( GreicioMatvaimas[ playerid ] == true )
  124. SetPlayerSpeedCap( playerid, 0.5 );
  125. else
  126. DisablePlayerSpeedCap( playerid );
  127. }
  128. public OnPlayerExitVehicle(playerid, vehicleid)
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnPlayerStateChange(playerid, newstate, oldstate)
  134. {
  135. return 1;
  136. }
  137.  
  138. public OnPlayerEnterCheckpoint(playerid)
  139. {
  140. return 1;
  141. }
  142.  
  143. public OnPlayerLeaveCheckpoint(playerid)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnPlayerEnterRaceCheckpoint(playerid)
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerLeaveRaceCheckpoint(playerid)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnRconCommand(cmd[])
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnPlayerRequestSpawn(playerid)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnObjectMoved(objectid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerObjectMoved(playerid, objectid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnPlayerPickUpPickup(playerid, pickupid)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnVehicleMod(playerid, vehicleid, componentid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnPlayerSelectedMenuRow(playerid, row)
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnPlayerExitedMenu(playerid)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnRconLoginAttempt(ip[], password[], success)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnPlayerUpdate(playerid)
  224. {
  225. static
  226. s_iVehicle
  227. ;
  228.  
  229. if ( g_fSpeedCap[ playerid ] != 0.0 && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
  230. {
  231. s_iVehicle = GetPlayerVehicleID( playerid );
  232.  
  233. if ( s_iVehicle )
  234. {
  235. static
  236. Float:s_fX,
  237. Float:s_fY,
  238. Float:s_fZ,
  239. Float:s_fVX,
  240. Float:s_fVY,
  241. Float:s_fVZ
  242. ;
  243.  
  244. GetVehiclePos( s_iVehicle, s_fX, s_fY, s_fZ );
  245. GetVehicleVelocity( s_iVehicle, s_fVX, s_fVY, s_fVZ );
  246.  
  247. if ( !IsPlayerInRangeOfPoint( playerid, g_fSpeedCap[ playerid ] + 0.05, s_fX + s_fVX, s_fY + s_fVY, s_fZ + s_fVZ ) )
  248. {
  249. static
  250. Float:s_fLength
  251. ;
  252.  
  253. s_fLength = floatsqroot( ( s_fVX * s_fVX ) + ( s_fVY * s_fVY ) + ( s_fVZ * s_fVZ ) );
  254.  
  255. s_fVX = ( s_fVX / s_fLength ) * g_fSpeedCap[ playerid ];
  256. s_fVY = ( s_fVY / s_fLength ) * g_fSpeedCap[ playerid ];
  257. s_fVZ = ( s_fVZ / s_fLength ) * g_fSpeedCap[ playerid ];
  258.  
  259. if ( s_iVehicle )
  260. SetVehicleVelocity( s_iVehicle, s_fVX, s_fVY, s_fVZ );
  261. else
  262. SetPlayerVelocity( playerid, s_fVX, s_fVY, s_fVZ );
  263. }
  264. }
  265. }
  266.  
  267. return 1;
  268. }
  269. public SetPlayerSpeedCap( playerid, Float:value )
  270. {
  271. if ( 0 <= playerid < sizeof( g_fSpeedCap ) )
  272. g_fSpeedCap[ playerid ] = value;
  273. }
  274.  
  275. public DisablePlayerSpeedCap( playerid )
  276. {
  277. if ( 0 <= playerid < sizeof( g_fSpeedCap ) )
  278. g_fSpeedCap[ playerid ] = 0.0;
  279. }
  280. public OnPlayerStreamIn(playerid, forplayerid)
  281. {
  282. return 1;
  283. }
  284.  
  285. public OnPlayerStreamOut(playerid, forplayerid)
  286. {
  287. return 1;
  288. }
  289.  
  290. public OnVehicleStreamIn(vehicleid, forplayerid)
  291. {
  292. return 1;
  293. }
  294.  
  295. public OnVehicleStreamOut(vehicleid, forplayerid)
  296. {
  297. return 1;
  298. }
  299.  
  300. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  301. {
  302. return 1;
  303. }
  304.  
  305. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  306. {
  307. return 1;
  308. }
Advertisement
Add Comment
Please, Sign In to add comment