23.04.2009, 20:38
Quote:
Originally Posted by Outbreak
I've got a spawn weapons feature, and im trying to create something to see what weapons each player has...
The weapons are stored in an array, im wondering is it possible to store, 12 weapons in an array, all with varying ammo.. Then use another function to extract the info on what weapons the player has... I've already got a command to see what weapons the player is carrying.. This isnt what im asking... I want to store weapon info in 1 array, then be able to extract the info and display it as weapons id and ammo amount. Is it possible? |
pawn Code:
new Ammo[12];
new Wep[12];
new WepName[12][20];
for(new i = 0; i < 12; i++)
{
GetPlayerWeaponData(idx, i+1, Wep[i], Ammo[i]);
GetWeaponName(Wep[i], WepName[i], 20);
}
Wep = Weapon ID
WepName = Weapon Name
the number inside [] is the slot
so if you want the ammo of the weapon is slot 5
Ammo[5]
The reason why it only goes to 12 is because in GetPlayerWeaponData I use +1
so it skips slot 0 because it's bugged and will go to 13 too
p.s credits to seifs admin script for helping me figure this out when I needed it a while ago