Advertisement
Nyft_

SISTEMA: Trocar de armas no passageiro ~Nyft

Aug 31st, 2021 (edited)
1,036
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include a_samp
  2. #include pawn.cmd
  3.  
  4. main(){}
  5.  
  6. public OnPlayerStateChange(playerid, newstate, oldstate)
  7. {
  8.     if(newstate == PLAYER_STATE_PASSENGER)
  9.         SetPVarInt(playerid, "curWeaponID", GetPlayerWeapon(playerid));
  10.  
  11.     return 1;
  12. }
  13.  
  14. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  15. {
  16.     if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER && IsBulletWeapon(GetPVarInt(playerid, "curWeaponID")))
  17.     {
  18.         if(newkeys & KEY_LOOK_RIGHT)
  19.         {
  20.             new curWeap = GetPVarInt(playerid, "curWeaponID"), weapSlot = GetWeaponSlot(curWeap), weapID, weapAmmo;
  21.  
  22.             for(new i = weapSlot + 1; i <= 7; i++)
  23.             {
  24.                 GetPlayerWeaponData(playerid, i, weapID, weapAmmo);
  25.                 if(IsBulletWeapon(weapID) && weapID != curWeap)
  26.                 {
  27.                     GameTextForPlayer(playerid, "~y~~h~Arma Seguinte ~>~", 1000, 3);
  28.                     SetPVarInt(playerid, "curWeaponID", weapID);
  29.                     SetPlayerArmedWeapon(playerid, weapID);
  30.                     break;
  31.                 }
  32.             }
  33.         }
  34.         if(newkeys & KEY_LOOK_LEFT)
  35.         {
  36.             new curWeap = GetPVarInt(playerid, "curWeaponID"), weapSlot = GetWeaponSlot(curWeap), weapID, weapAmmo;
  37.  
  38.             for(new i = weapSlot - 1; i >= 2; i--)
  39.             {
  40.                 GetPlayerWeaponData(playerid, i, weapID, weapAmmo);
  41.                 if(IsBulletWeapon(weapID) && weapID != curWeap)
  42.                 {
  43.                     GameTextForPlayer(playerid, "~y~~h~~<~ Arma Anterior", 1000, 3);
  44.                     SetPVarInt(playerid, "curWeaponID", weapID);
  45.                     SetPlayerArmedWeapon(playerid, weapID);
  46.                     break;
  47.                 }
  48.             }
  49.         }
  50.     }
  51.     return 1;
  52. }
  53.  
  54. // -----------------------------------------------------------------------------
  55.  
  56. IsBulletWeapon(weaponid)
  57.     return (WEAPON_COLT45 <= weaponid <= WEAPON_SNIPER) || weaponid == WEAPON_MINIGUN;
  58.  
  59. GetWeaponSlot(weaponid)
  60. {
  61.     switch(weaponid)
  62.     {
  63.         case 0, 1:       return 0;
  64.         case 2..9:       return 1;
  65.         case 22..24:     return 2;
  66.         case 25..27:     return 3;
  67.         case 28, 29, 32: return 4;
  68.         case 30, 31:     return 5;
  69.         case 33, 34:     return 6;
  70.         case 35..38:     return 7;
  71.         case 16..18, 39: return 8;
  72.         case 41..43:     return 9;
  73.         case 10..15:     return 10;
  74.         case 44..46:     return 11;
  75.         case 40:         return 12;
  76.     }
  77.     return -1;
  78. }
  79.  
  80. // -----------------------------------------------------------------------------
  81.  
  82. CMD:nrg(playerid)
  83. {
  84.     new vehicleid, Float:x, Float:y, Float:z, Float:a;
  85.     GetPlayerPos(playerid, x, y, z);
  86.     GetPlayerFacingAngle(playerid, a);
  87.  
  88.     vehicleid = CreateVehicle(522, x, y, z, a, -1, -1, -1);
  89.     PutPlayerInVehicle(playerid, vehicleid, 1);
  90.     return 1;
  91. }
  92. CMD:sul(playerid)
  93. {
  94.     new vehicleid, Float:x, Float:y, Float:z, Float:a;
  95.     GetPlayerPos(playerid, x, y, z);
  96.     GetPlayerFacingAngle(playerid, a);
  97.  
  98.     vehicleid = CreateVehicle(560, x, y, z, a, -1, -1, -1);
  99.     PutPlayerInVehicle(playerid, vehicleid, 1);
  100.     return 1;
  101. }
  102. CMD:armas(playerid)
  103. {
  104.     GivePlayerWeapon(playerid, 38, 9999);
  105.     GivePlayerWeapon(playerid, 24, 9999);
  106.     GivePlayerWeapon(playerid, 26, 9999);
  107.     GivePlayerWeapon(playerid, 31, 9999);
  108.     GivePlayerWeapon(playerid, 34, 9999);
  109.     return 1;
  110. }
Advertisement
RAW Paste Data Copied
Advertisement