ProDude

SuperPowers

Mar 21st, 2016
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. /* SuperHuman V1 - (c) PRODUDE 2011 */
  2.  
  3. #include <a_samp>
  4.  
  5. #define Callback:%0(%1) forward %0(%1); public %0(%1)
  6.  
  7. new
  8. bool:PowerEnabled[MAX_PLAYERS],
  9. GroundExplosionTimer[MAX_PLAYERS] = { -1, ... },
  10. PlayerAnimLib[MAX_PLAYERS][32],
  11. PlayerAnimName[MAX_PLAYERS][32]
  12. ;
  13.  
  14. Callback:OnFilterScriptInit()
  15. {
  16. printf("\n SuperHuman V1 - (c) iPLEOMAX 2011 Loaded! \n");
  17. return true;
  18. }
  19.  
  20. Callback:OnFilterScriptExit() return true;
  21.  
  22. Callback:OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  23. {
  24. if (PowerEnabled[playerid]) ActivateMotion(playerid, newkeys);
  25. return true;
  26. }
  27.  
  28. Callback:ActivateMotion(playerid, player_keys)
  29. {
  30. new
  31. Float:X, Float:Y, Float:Z,
  32. Float:VX, Float:VY, Float:VZ,
  33. Float:pAng
  34. ;
  35.  
  36. GetPlayerCameraFrontVector(playerid, VX, VY, VZ);
  37. GetAnimationName(GetPlayerAnimationIndex(playerid), PlayerAnimLib[playerid], 32, PlayerAnimName[playerid], 32);
  38.  
  39. if(strlen(PlayerAnimLib[playerid]) && !strcmp(PlayerAnimLib[playerid], "ped", true, 3))
  40. {
  41. if (player_keys & KEY_SPRINT)
  42. {
  43. GetPlayerFacingAngle(playerid, pAng);
  44. GetPlayerVelocity(playerid, X, Y, Z);
  45. SetPlayerVelocity(playerid, floatsin(-pAng, degrees) * 1.6, floatcos(pAng, degrees) * 1.6 , (Z*2)+0.03);
  46. } else
  47.  
  48. if (player_keys & KEY_JUMP)
  49. {
  50. if(strlen(PlayerAnimName[playerid])
  51. && !strcmp(PlayerAnimName[playerid], "IDLE_", true, 5)
  52. || !strcmp(PlayerAnimName[playerid], "GETUP_", true, 6)
  53. || !strcmp(PlayerAnimName[playerid], "WALK_", true, 5)
  54. || !strcmp(PlayerAnimName[playerid], "FALL_", true, 5)
  55. || !strcmp(PlayerAnimName[playerid], "FACTALK", true, 7)
  56. || !strcmp(PlayerAnimName[playerid], "JUMP_", true, 5)
  57. || !strcmp(PlayerAnimName[playerid], "FALL_", true, 5)
  58. || !strcmp(PlayerAnimName[playerid], "RUN_", true, 4))
  59.  
  60. {
  61. SetPlayerVelocity(playerid, 0, 0, 5);
  62.  
  63. GetPlayerPos(playerid, X, Y, Z);
  64. AngleXYInFrontOfPlayer(playerid, X, Y, -2.7, 30);
  65. CreateExplosion(X, Y, Z, 4, 10);
  66. CreateExplosion(X, Y, Z, 2, 2);
  67.  
  68. GetPlayerPos(playerid, X, Y, Z);
  69. AngleXYInFrontOfPlayer(playerid, X, Y, -2.7, -30);
  70. CreateExplosion(X, Y, Z, 4, 10);
  71. CreateExplosion(X, Y, Z, 2, 2);
  72. }
  73. } else
  74.  
  75. if (player_keys & KEY_FIRE)
  76. {
  77. if (strlen(PlayerAnimName[playerid])
  78. && !strcmp(PlayerAnimName[playerid], "JUMP_", true, 5)
  79. || !strcmp(PlayerAnimName[playerid], "FACTALK", true, 7)
  80. || !strcmp(PlayerAnimName[playerid], "FALL_", true, 5))
  81.  
  82. {
  83. new
  84. Float:fAng,
  85. Float:X1, Float:Y1, Float:Z1,
  86. Float:X2, Float:Y2, Float:Z2
  87. ;
  88. GetPlayerPos(playerid, X1, Y1, Z1);
  89. GetPlayerCameraPos(playerid, X2, Y2, Z2);
  90. #pragma unused Z1
  91. #pragma unused Z2
  92. fAng = (atan2(Y2-Y1, X2-X1))-270;
  93.  
  94. ClearAnimations(playerid);
  95. SetPlayerFacingAngle(playerid, fAng);
  96. SetPlayerVelocity(playerid, VX, VY, VZ+0.5);
  97. }
  98. } else
  99.  
  100. if (player_keys & KEY_CROUCH)
  101. {
  102. SetPlayerVelocity(playerid, 0, 0, -50);
  103. KillTimer(GroundExplosionTimer[playerid]);
  104. GroundExplosionTimer[playerid] = SetTimerEx("Gexplode", 250, false, "d", playerid);
  105. }
  106. }
  107. return true;
  108. }
  109.  
  110. Callback:Gexplode(playerid)
  111. {
  112. new Float:X, Float:Y, Float:Z;
  113. GetPlayerPos(playerid, X, Y, Z);
  114. CreateExplosion(X, Y, Z, 4, 10);
  115. CreateExplosion(X, Y, Z, 2, 2);
  116. return true;
  117. }
  118.  
  119. Callback:OnPlayerDisconnect(playerid, reason)
  120. {
  121. PowerEnabled[playerid] = false;
  122. return true;
  123. }
  124.  
  125. Callback:OnPlayerSpawn(playerid)
  126. {
  127. if (PowerEnabled[playerid]) SetPlayerHealth(playerid, 0x107FFF);
  128. return true;
  129. }
  130.  
  131. Callback:OnPlayerCommandText(playerid, cmdtext[])
  132. {
  133. if(!strcmp(cmdtext, "/superhuman", true, 11) && strlen(cmdtext))
  134. {
  135. if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERROR] Only Admins can use this command.");
  136. if (PowerEnabled[playerid])
  137. {
  138. SetPlayerHealth(playerid, 100);
  139. SendClientMessage(playerid, 0x00FFFFFF, "*** You no longer have the Super Human abilities... ***");
  140. PowerEnabled[playerid] = false;
  141. } else {
  142. SendClientMessage(playerid, 0x00FFFFFF, "*** Acquired Super powers! ***");
  143. SendClientMessage(playerid, 0xFFFFFFFF, "- Use Sprint Key to Boost run.");
  144. SendClientMessage(playerid, 0xFFFFFFFF, "- Use Jump Key to Super Jump.");
  145. SendClientMessage(playerid, 0xFFFFFFFF, "- Use Crouch Key to Land at lighting speed.");
  146. SendClientMessage(playerid, 0xFFFFFFFF, "- Use Fire to Accelerate towards your point of view.");
  147. SetPlayerHealth(playerid, 0x107FFF);
  148. PowerEnabled[playerid] = true;
  149. }
  150. return true;
  151. }
  152. return false;
  153. }
  154.  
  155. AngleXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance, Float:Angle = 0.0)
  156. { //by Y_Less (a little change by pleomax)
  157.  
  158. new Float:a;
  159.  
  160. GetPlayerPos(playerid, x, y, a);
  161. GetPlayerFacingAngle(playerid, a);
  162.  
  163. if (GetPlayerVehicleID(playerid)) {
  164. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  165. }
  166.  
  167. x += (distance * floatsin(-(a+Angle), degrees));
  168. y += (distance * floatcos(-(a+Angle), degrees));
  169. }
Add Comment
Please, Sign In to add comment