Advertisement
iPLEOMAX

SuperHuman.pwn [V1]

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