Advertisement
Guest User

Untitled

a guest
Feb 10th, 2009
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.48 KB | None | 0 0
  1. /*
  2.     Some people might find this useful...
  3.     I use this system in my WorldCup gamemode and it works very well. It should drastically reduce ammo bugs from occurring.
  4.     I recommend implementing this into your gamemode rather than using it as an include. Enjoy!
  5.     by: [NB]90NINE
  6. */
  7.  
  8. #define MAX_SLOTS 13
  9. #define MAX_SERVER_PLAYERS 200//edit this to match your server's limit
  10.  
  11. #define _GUN 0//just makes it easier to understand
  12. #define _AMMO 1
  13.  
  14. new tempweap[MAX_SERVER_PLAYERS][MAX_SLOTS][2];
  15.  
  16. stock GetPlayerWeapons(playerid)
  17. {
  18.     //we'll get the ammo from the guns first to prevent potential ammo bugs
  19.     GetPlayerWeaponData(playerid,2,tempweap[playerid][2][_GUN],tempweap[playerid][2][_AMMO]);
  20.     GetPlayerWeaponData(playerid,3,tempweap[playerid][3][_GUN],tempweap[playerid][3][_AMMO]);
  21.     GetPlayerWeaponData(playerid,4,tempweap[playerid][4][_GUN],tempweap[playerid][4][_AMMO]);
  22.     GetPlayerWeaponData(playerid,5,tempweap[playerid][5][_GUN],tempweap[playerid][5][_AMMO]);
  23.     GetPlayerWeaponData(playerid,6,tempweap[playerid][6][_GUN],tempweap[playerid][6][_AMMO]);
  24.     GetPlayerWeaponData(playerid,7,tempweap[playerid][7][_GUN],tempweap[playerid][7][_AMMO]);
  25.     GetPlayerWeaponData(playerid,8,tempweap[playerid][8][_GUN],tempweap[playerid][8][_AMMO]);
  26.     GetPlayerWeaponData(playerid,9,tempweap[playerid][9][_GUN],tempweap[playerid][9][_AMMO]);
  27.     GetPlayerWeaponData(playerid,10,tempweap[playerid][10][_GUN],tempweap[playerid][10][_AMMO]);
  28.    
  29.     //now we check to see if they are holding any melee weapons (we get these second because they return 65535 sometimes and that bugs the ammo for the next slot)
  30.     GetPlayerWeaponData(playerid,0,tempweap[playerid][0][_GUN],tempweap[playerid][0][_AMMO]);if(tempweap[playerid][0][_AMMO] > 1)tempweap[playerid][0][_AMMO] = 1;
  31.     GetPlayerWeaponData(playerid,1,tempweap[playerid][1][_GUN],tempweap[playerid][1][_AMMO]);if(tempweap[playerid][1][_AMMO] > 1)tempweap[playerid][1][_AMMO] = 1;
  32.     GetPlayerWeaponData(playerid,11,tempweap[playerid][11][_GUN],tempweap[playerid][11][_AMMO]);if(tempweap[playerid][11][_AMMO] > 1)tempweap[playerid][11][_AMMO] = 1;
  33.     GetPlayerWeaponData(playerid,12,tempweap[playerid][12][_GUN],tempweap[playerid][12][_AMMO]);if(tempweap[playerid][12][_AMMO] > 1)tempweap[playerid][12][_AMMO] = 1;
  34.    
  35.     //now we check to see if the player is in a vehicle so we can get the correct ammo for slot 4 (smg), which would only work before if the player entered the vehicle holding an smg
  36.     if(IsPlayerInAnyVehicle(playerid))tempweap[playerid][4][_AMMO] = GetPlayerAmmo(playerid);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement