13.05.2014, 12:48
Quote:
pawn Код:
|
Also where is wslot declared? You should either create an array at the top of your script where you assign each weapon id the associated weapon slot or (if you don't intent to use it anywhere else) use the correct wslot for every case in the switch construct.
Or, if you want to save all weapon slots regardless of what weapon you give the player, just save them all after the switch statement:
pawn Код:
for (new slot = 0; slot < 13; slot++)
GetPlayerWeaponData(playerid, slot, PlayerInfo[playerid][wslot[slot]], PlayerInfo[playerid][wslotammo[slot]]);
pawn Код:
static const
WeaponIDSlot[] = {0, 0, 1, 1, 1, 1 , 1, 1, 1, 1, 10, 10, 10, 10, 10, 10, 8, 8, 8, -1, -1, -1,
2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 4, 6, 6, 7, 7, 7, 7, 8, 12, 9, 9, 9, 11, 11, 11};
But then you can't easily access the PlayerInfo[playerid][wslot] construct anymore, so you should declare that just like:
pawn Код:
new PlayerWeapons[MAX_PLAYERS][12];
new PlayerAmmo[MAX_PLAYERS][12];
pawn Код:
case 0:
{
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 50); // Give them a desert eagle
PlayerInfo[playerid][Cookies] -= 5;
GetPlayerWeaponData(playerid, WeaponIDSlot[WEAPON_DEAGLE], PlayerWeapons[playerid][WeaponIDSlot[WEAPON_DEAGLE]], PlayerAmmo[playerid][WeaponIDSlot[WEAPON_DEAGLE]]);
}
I hope this helps you.