Compiler1

SuperJump FS

Mar 10th, 2016
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1. /*
  2.  
  3. THIS IS A SUPERJUMP FS MADE BY COMPILER. FORUM TOPIC ( http://forum.sa-mp.com/showthread.php?p=3669671#post3669671 ).
  4.  
  5. INTRODUCTION:-
  6.  
  7. • This Filterscript is made by Me( Compiler ), Please don't remove the credits.
  8. • Forum Member ( http://forum.sa-mp.com/member.php?u=271074 ).
  9. • This is a Filterscript that will allow the player to jump high.
  10. • This Filterscript also contains saving system with Y_ini.
  11.  
  12. COMMAND(S):-
  13.  
  14. • /superjump - Enables / Disables superjump.
  15. • /sj - Does the same work of /superjump.
  16.  
  17. CREDITS:-
  18.  
  19. • Compiler - For making this Filterscript.
  20. • Sreyas - For explaining me( Compiler ) Y_ini.
  21.  
  22. */
  23.  
  24. //==============================================================================
  25. // -> Includes
  26. //==============================================================================
  27. #include <a_samp>
  28. #include <zcmd>
  29. #include <YSI\y_ini>
  30.  
  31. //==============================================================================
  32. // -> Defines
  33. //==============================================================================
  34. #define GREEN "{11ED65}"
  35. #define RED "{FF0000}"
  36. #define GREY "{C0C4C4}"
  37.  
  38. #define JUMP_HEIGHT 5
  39.  
  40. //==============================================================================
  41. // -> Saving Path
  42. //==============================================================================
  43. #define JumpSave "SuperJump/%s.ini"
  44.  
  45. //==============================================================================
  46. // -> Forward(s)
  47. //==============================================================================
  48. forward Jump0(playerid);
  49. forward Jump1(playerid);
  50.  
  51. //==============================================================================
  52. // -> Enum
  53. //==============================================================================
  54. enum Jump
  55. {
  56. pJump,
  57. }
  58.  
  59. //==============================================================================
  60. // -> Variable(s)
  61. //==============================================================================
  62. new SJump[MAX_PLAYERS][Jump];
  63.  
  64. //==============================================================================
  65. //----------------------------------------------------------------------
  66. // -> Saving Stock
  67. //----------------------------------------------------------------------
  68. //==============================================================================
  69. stock Jfile(playerid)
  70. {
  71. new string[128],playername[MAX_PLAYER_NAME];
  72. GetPlayerName(playerid,playername,sizeof(playername));
  73. format(string,sizeof(string),JumpSave,playername);
  74. return string;
  75. }
  76.  
  77. //==============================================================================
  78. //----------------------------------------------------------------------
  79. // -> Loading Filterscript.
  80. //----------------------------------------------------------------------
  81. //==============================================================================
  82. public OnFilterScriptInit()
  83. {
  84. print("\n===========================================");
  85. print("Super-Jump Filterscript by Compiler Loaded!");
  86. print("===========================================\n");
  87. return 1;
  88. }
  89.  
  90. //==============================================================================
  91. //----------------------------------------------------------------------
  92. // -> Unloading Filterscript.
  93. //----------------------------------------------------------------------
  94. //==============================================================================
  95. public OnFilterScriptExit()
  96. {
  97. print("\n===========================================");
  98. print("Super-Jump Filterscript by Compiler Unloaded!");
  99. print("===========================================\n");
  100. return 1;
  101. }
  102.  
  103. //==============================================================================
  104. //----------------------------------------------------------------------
  105. // -> The Key Pressing.
  106. //----------------------------------------------------------------------
  107. //==============================================================================
  108. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  109. {
  110. if(SJump[playerid][pJump] == 1)
  111. {
  112. if(newkeys & KEY_JUMP)
  113. {
  114. new Float:SJ[3];
  115.  
  116. GetPlayerVelocity(playerid, SJ[0], SJ[1], SJ[2]);
  117. SetPlayerVelocity(playerid, SJ[0], SJ[1], SJ[2] + JUMP_HEIGHT);
  118. SJump[playerid][pJump] = 0;
  119. SetTimer("Jump0", 2000, false); // I used it so that players don't jump again before landing.
  120.  
  121. }
  122.  
  123. }
  124. return 1;
  125. }
  126. //==============================================================================
  127. //----------------------------------------------------------------------
  128. // -> Jump CallBack.
  129. //----------------------------------------------------------------------
  130. //==============================================================================
  131. public Jump0(playerid)
  132. {
  133. SJump[playerid][pJump] = 0;
  134. SetTimer("Jump1", 1, false);
  135. }
  136. public Jump1(playerid) SJump[playerid][pJump] = 1;
  137.  
  138. //==============================================================================
  139. //----------------------------------------------------------------------
  140. // -> When the player Disconnects
  141. //----------------------------------------------------------------------
  142. //==============================================================================
  143. public OnPlayerDisconnect(playerid,reason)
  144. {
  145. if(SJump[playerid][pJump] == 1)
  146. {
  147. new INI:file = INI_Open(Jfile(playerid));
  148. INI_WriteInt(file, "SuperJump", 1);
  149. INI_Close(file);
  150. }
  151. return 1;
  152. }
  153.  
  154. //==============================================================================
  155. //----------------------------------------------------------------------
  156. // -> When the player Connects
  157. //----------------------------------------------------------------------
  158. //==============================================================================
  159. public OnPlayerConnect(playerid)
  160. {
  161. if(fexist(Jfile(playerid)))
  162. {
  163. SJump[playerid][pJump] = 1;
  164. fremove(Jfile(playerid));
  165. }
  166. else
  167. {
  168. SJump[playerid][pJump] = 0;
  169. }
  170. return 1;
  171. }
  172.  
  173. //==============================================================================
  174. //----------------------------------------------------------------------
  175. // -> Command(s)
  176. //----------------------------------------------------------------------
  177. //==============================================================================
  178. CMD:superjump(playerid, params[])
  179. {
  180. if(SJump[playerid][pJump] == 1)
  181. {
  182. SJump[playerid][pJump] = 0;
  183. SendClientMessage(playerid, -1, RED"[SUPERJUMP]"GREY" SuperJump has been "RED"Disabled"GREY"!");
  184. }
  185. else if(SJump[playerid][pJump] == 0)
  186. {
  187. SJump[playerid][pJump] = 1;
  188. SendClientMessage(playerid, -1, RED"[SUPERJUMP]"GREY" SuperJump has been "GREEN"Enabled"GREY"!");
  189. }
  190. return 1;
  191. }
  192. CMD:sj(playerid, params[]) return cmd_superjump(playerid, params);
  193.  
  194. //=======================================================================================================
  195. //-------------------------------------------------------------------------------------------------------
  196. // END OF IT
  197. //-------------------------------------------------------------------------------------------------------
  198. //=======================================================================================================
Add Comment
Please, Sign In to add comment