Guest User

afly

a guest
Feb 4th, 2012
1,193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.34 KB | None | 0 0
  1. #if defined (c)Copyright_2012
  2. ________________________________________________________________________________
  3. ********************************************************************************
  4. ================================================================================
  5.  
  6. aFly (source code)
  7. ----------------------
  8. - by Vishnu
  9.  
  10. ________________________________________________________________________________
  11. ********************************************************************************
  12. ================================================================================
  13.  
  14. CONTACT INFO
  15. ------------
  16.  
  17. email <::> [email protected]
  18. facebook <::> facebook.com/vishnu4307
  19. website <::> www.vggaming.tk
  20.  
  21. If anyone have any doubts or complaints or suggestion about this gamemode please
  22. feel free to inform me.
  23. I am looking for co developers. If you are willing to help please contact me.
  24. ________________________________________________________________________________
  25. ********************************************************************************
  26. ================================================================================
  27. INFO
  28. ----
  29. * ZCMD include from Zeex needed to compile the script.
  30.  
  31. * Use /fly to switch to aFly mode and /fly again toe deactivate aFly.
  32.  
  33. ***Say good bye to the bugged s0biet and other hacks!***
  34.  
  35. ________________________________________________________________________________
  36. ********************************************************************************
  37. ================================================================================
  38. /*
  39. /\
  40. //\\
  41. // \\
  42. // \\
  43. // \\
  44. // RULES \\
  45. // \\
  46. -------------
  47. */
  48. RULE 1 -
  49. --------
  50. " You may not sell this script under any circumstances. "
  51.  
  52. RULE 2 -
  53. --------
  54. " You may edit this script. But don't claim it as yours. "
  55.  
  56. ________________________________________________________________________________
  57. ********************************************************************************
  58. ================================================================================
  59. #endif
  60.  
  61. //==============================================================================
  62. //-------------------------------------------------
  63. // Includes
  64. //-------------------------------------------------
  65. //==============================================================================
  66. #include <a_samp>
  67. #include <zcmd>
  68. //==============================================================================
  69. //-------------------------------------------------
  70. // Variables
  71. //-------------------------------------------------
  72. //==============================================================================
  73. new bool:flying[MAX_PLAYERS];
  74. //==============================================================================
  75. //-------------------------------------------------
  76. // Forwards
  77. //-------------------------------------------------
  78. //==============================================================================
  79. forward AdminFly(playerid);
  80. forward Float:SetPlayerToFacePos(playerid, Float:X, Float:Y);
  81. //==============================================================================
  82. //-------------------------------------------------
  83. // Primary callbacks
  84. //-------------------------------------------------
  85. //==============================================================================
  86. public OnFilterScriptInit()
  87. {
  88. new year,month,day;
  89. getdate(year, month, day);
  90. new hour,minute,second;
  91. gettime(hour,minute,second);
  92.  
  93. printf("\n------------------------------------------------");
  94. printf(" aFly by Vishnu - Replace s0biet, Replace hacks");
  95. printf("------------------------------------------------\n");
  96.  
  97. printf("| LOADED | Date: %d/%d/%d | Time: %d:%d:%d |",day,month,year,hour, minute, second);
  98. return 1;
  99. }
  100.  
  101. public OnFilterScriptExit()
  102. {
  103. new year,month,day;
  104. getdate(year, month, day);
  105. new hour,minute,second;
  106. gettime(hour,minute,second);
  107.  
  108. printf("\n------------------------------------------------");
  109. printf(" aFly by Vishnu - Replace s0biet, Replace hacks");
  110. printf("------------------------------------------------\n");
  111.  
  112. printf("| UNLOADED | Date: %d/%d/%d | Time: %d:%d:%d |",day,month,year,hour, minute, second);
  113. return 1;
  114. }
  115.  
  116. //==============================================================================
  117. //-------------------------------------------------
  118. // Secondary callbacks
  119. //-------------------------------------------------
  120. //==============================================================================
  121. public AdminFly(playerid)
  122. {
  123. if(!IsPlayerConnected(playerid))
  124. return flying[playerid] = false;
  125.  
  126. if(flying[playerid])
  127. {
  128. if(!IsPlayerInAnyVehicle(playerid))
  129. {
  130. new
  131. keys,
  132. ud,
  133. lr,
  134. Float:x[2],
  135. Float:y[2],
  136. Float:z;
  137.  
  138. GetPlayerKeys(playerid, keys, ud, lr);
  139. GetPlayerVelocity(playerid, x[0], y[0], z);
  140. if(ud == KEY_UP)
  141. {
  142. GetPlayerCameraPos(playerid, x[0], y[0], z);
  143. GetPlayerCameraFrontVector(playerid, x[1], y[1], z);
  144. ApplyAnimation(playerid, "SWIM", "SWIM_crawl", 4.1, 0, 1, 1, 0, 0);
  145. SetPlayerToFacePos(playerid, x[0] + x[1], y[0] + y[1]);
  146. SetPlayerVelocity(playerid, x[1], y[1], z);
  147. }
  148. else
  149. SetPlayerVelocity(playerid, 0.0, 0.0, 0.01);
  150. }
  151. SetTimerEx("AdminFly", 100, 0, "d", playerid);
  152. }
  153. return 0;
  154. }
  155.  
  156. public Float:SetPlayerToFacePos(playerid, Float:X, Float:Y)
  157. {
  158. new
  159. Float:pX1,
  160. Float:pY1,
  161. Float:pZ1,
  162. Float:ang;
  163.  
  164. if(!IsPlayerConnected(playerid)) return 0.0;
  165.  
  166. GetPlayerPos(playerid, pX1, pY1, pZ1);
  167.  
  168. if( Y > pY1 ) ang = (-acos((X - pX1) / floatsqroot((X - pX1)*(X - pX1) + (Y - pY1)*(Y - pY1))) - 90.0);
  169. else if( Y < pY1 && X < pX1 ) ang = (acos((X - pX1) / floatsqroot((X - pX1)*(X - pX1) + (Y - pY1)*(Y - pY1))) - 450.0);
  170. else if( Y < pY1 ) ang = (acos((X - pX1) / floatsqroot((X - pX1)*(X - pX1) + (Y - pY1)*(Y - pY1))) - 90.0);
  171.  
  172. if(X > pX1) ang = (floatabs(floatabs(ang) + 180.0));
  173. else ang = (floatabs(ang) - 180.0);
  174.  
  175. ang += 180.0;
  176.  
  177. SetPlayerFacingAngle(playerid, ang);
  178.  
  179. return ang;
  180. }
  181. //==============================================================================
  182. //-------------------------------------------------
  183. // ZCMD commands
  184. //-------------------------------------------------
  185. //==============================================================================
  186. CMD:fly(playerid, params[])
  187. {
  188. if(IsPlayerAdmin(playerid))
  189. {
  190.  
  191.  
  192. new Float:x, Float:y, Float:z;
  193. if((flying[playerid] = !flying[playerid]))
  194. {
  195. GetPlayerPos(playerid, x, y, z);
  196. SetPlayerPos(playerid, x, y, z+5);
  197. SetPlayerArmour(playerid, 1000000000.0);
  198. SetPlayerHealth(playerid, 1000000000.0);
  199. SetTimerEx("AdminFly", 100, 0, "d", playerid);
  200. }
  201. else
  202. {
  203. GetPlayerPos(playerid, x, y, z);
  204. SetPlayerPos(playerid, x, y, z+0.5);
  205. ClearAnimations(playerid);
  206. SetPlayerArmour(playerid, 100.0);
  207. SetPlayerHealth(playerid, 100.0);
  208. return 1;
  209. }
  210. }
  211. else
  212. {
  213. SendClientMessage(playerid, 0xB4B5B7FF, "You are not authorized to use that command.");
  214. }
  215. return 1;
  216. }
  217. // © VGGaming 2012 - All rights Reserved
Advertisement
Add Comment
Please, Sign In to add comment