Advertisement
Joey_Simmons

Weapons in Stars And Stripes Multiplayer.

Apr 17th, 2025
308
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.08 KB | None | 0 0
  1. #include <a_samp>
  2. #include <sscanf2>
  3. #include <zcmd>
  4.  
  5. CMD:weapon(playerid, params[])
  6. {
  7.     if(!IsPlayerAdmin(playerid))
  8.     {
  9.         SendClientMessage(playerid, 0xFF0000FF, "Error: You must be an RCON admin to use this command!");
  10.         return 1;
  11.     }
  12.  
  13.     new weaponid;
  14.     if(sscanf(params, "i", weaponid))
  15.     {
  16.         SendClientMessage(playerid, 0xFFFF00FF, "Usage: /weapon [weapon_id]");
  17.         SendClientMessage(playerid, 0xFFFF00FF, "Valid IDs: 70-92, 99-175");
  18.         return 1;
  19.     }
  20.  
  21.     new bool:isValid = (weaponid >= 70 && weaponid <= 92) || (weaponid >= 99 && weaponid <= 175);
  22.     switch(isValid)
  23.     {
  24.         case true:
  25.         {
  26.             GivePlayerWeapon(playerid, weaponid, 100);
  27.             new string[128];
  28.             format(string, sizeof(string), "You have received weapon ID %d.", weaponid);
  29.             SendClientMessage(playerid, 0x00FF00FF, string);
  30.         }
  31.         case false:
  32.         {
  33.             SendClientMessage(playerid, 0xFF0000FF, "Error: Invalid weapon ID! Valid IDs: 70-92, 99-175");
  34.         }
  35.     }
  36.  
  37.     return 1;
  38. }
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement