Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Some people might find this useful...
- I use this system in my WorldCup gamemode and it works very well. It should drastically reduce ammo bugs from occurring.
- I recommend implementing this into your gamemode rather than using it as an include. Enjoy!
- by: [NB]90NINE
- */
- #define MAX_SLOTS 13
- #define MAX_SERVER_PLAYERS 200//edit this to match your server's limit
- #define _GUN 0//just makes it easier to understand
- #define _AMMO 1
- new tempweap[MAX_SERVER_PLAYERS][MAX_SLOTS][2];
- stock GetPlayerWeapons(playerid)
- {
- //we'll get the ammo from the guns first to prevent potential ammo bugs
- GetPlayerWeaponData(playerid,2,tempweap[playerid][2][_GUN],tempweap[playerid][2][_AMMO]);
- GetPlayerWeaponData(playerid,3,tempweap[playerid][3][_GUN],tempweap[playerid][3][_AMMO]);
- GetPlayerWeaponData(playerid,4,tempweap[playerid][4][_GUN],tempweap[playerid][4][_AMMO]);
- GetPlayerWeaponData(playerid,5,tempweap[playerid][5][_GUN],tempweap[playerid][5][_AMMO]);
- GetPlayerWeaponData(playerid,6,tempweap[playerid][6][_GUN],tempweap[playerid][6][_AMMO]);
- GetPlayerWeaponData(playerid,7,tempweap[playerid][7][_GUN],tempweap[playerid][7][_AMMO]);
- GetPlayerWeaponData(playerid,8,tempweap[playerid][8][_GUN],tempweap[playerid][8][_AMMO]);
- GetPlayerWeaponData(playerid,9,tempweap[playerid][9][_GUN],tempweap[playerid][9][_AMMO]);
- GetPlayerWeaponData(playerid,10,tempweap[playerid][10][_GUN],tempweap[playerid][10][_AMMO]);
- //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)
- GetPlayerWeaponData(playerid,0,tempweap[playerid][0][_GUN],tempweap[playerid][0][_AMMO]);if(tempweap[playerid][0][_AMMO] > 1)tempweap[playerid][0][_AMMO] = 1;
- GetPlayerWeaponData(playerid,1,tempweap[playerid][1][_GUN],tempweap[playerid][1][_AMMO]);if(tempweap[playerid][1][_AMMO] > 1)tempweap[playerid][1][_AMMO] = 1;
- GetPlayerWeaponData(playerid,11,tempweap[playerid][11][_GUN],tempweap[playerid][11][_AMMO]);if(tempweap[playerid][11][_AMMO] > 1)tempweap[playerid][11][_AMMO] = 1;
- GetPlayerWeaponData(playerid,12,tempweap[playerid][12][_GUN],tempweap[playerid][12][_AMMO]);if(tempweap[playerid][12][_AMMO] > 1)tempweap[playerid][12][_AMMO] = 1;
- //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
- if(IsPlayerInAnyVehicle(playerid))tempweap[playerid][4][_AMMO] = GetPlayerAmmo(playerid);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement