Are we suppose to guess the codes?
post the codes that save and load the weapon's ammo |
stock GivePlayerValidAdminWeapon(playerid, WeaponID, Ammo)
{
if(PlayerInfo[playerid][pConnectTime] < 2 && WeaponID != 46 && WeaponID != 43) return 1;
switch(WeaponID)
{
case 0, 1:
{
PlayerInfo[playerid][pAGuns][0] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
PlayerInfo[playerid][pAGuns][1] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 22, 23, 24:
{
PlayerInfo[playerid][pAGuns][2] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 25, 26, 27:
{
PlayerInfo[playerid][pAGuns][ 3 ] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 28, 29, 32:
{
PlayerInfo[playerid][pAGuns][4] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 30, 31:
{
PlayerInfo[playerid][pAGuns][5] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 33, 34:
{
PlayerInfo[playerid][pAGuns][6] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 35, 36, 37, 38:
{
PlayerInfo[playerid][pAGuns][7] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 16, 17, 18, 39, 40:
{
PlayerInfo[playerid][pAGuns][8] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 41, 42, 43:
{
PlayerInfo[playerid][pAGuns][9] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 10, 11, 12, 13, 14, 15:
{
PlayerInfo[playerid][pAGuns][10] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 44, 45, 46:
{
PlayerInfo[playerid][pAGuns][11] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
}
return 1;
}
stock GivePlayerValidWeapon(playerid, WeaponID, Ammo)
{
if(PlayerInfo[playerid][pConnectTime] < 2 && WeaponID != 46 && WeaponID != 43) return 1;
switch(WeaponID)
{
case 0, 1:
{
PlayerInfo[playerid][pGuns][0] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
PlayerInfo[playerid][pGuns][1] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 22, 23, 24:
{
PlayerInfo[playerid][pGuns][2] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 25, 26, 27:
{
PlayerInfo[playerid][pGuns][ 3 ] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 28, 29, 32:
{
PlayerInfo[playerid][pGuns][4] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 30, 31:
{
PlayerInfo[playerid][pGuns][5] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 33, 34:
{
PlayerInfo[playerid][pGuns][6] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 35, 36, 37, 38:
{
PlayerInfo[playerid][pGuns][7] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 16, 17, 18, 39, 40:
{
PlayerInfo[playerid][pGuns][8] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 41, 42, 43:
{
PlayerInfo[playerid][pGuns][9] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 10, 11, 12, 13, 14, 15:
{
PlayerInfo[playerid][pGuns][10] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
case 44, 45, 46:
{
PlayerInfo[playerid][pGuns][11] = WeaponID;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
}
return 1;
}
stock SetPlayerWeapons(playerid)
{
if(GetPVarInt(playerid, "PBM") > 0) { return 1; }
ResetPlayerWeapons(playerid);
for(new s = 0; s < 12; s++)
{
if(PlayerInfo[playerid][pGuns][s] > 0 && PlayerInfo[playerid][pAGuns][s] == 0)
{
if(PlayerInfo[playerid][pGuns][s] == 17)
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][pGuns][s], 5);
else
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][pGuns][s], 60000);
}
}
return 1;
}
stock SetPlayerWeaponsEx(playerid)
{
ResetPlayerWeapons(playerid);
for(new s = 0; s < 12; s++)
{
if(PlayerInfo[playerid][pGuns][s] > 0)
{
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][pGuns][s], 60000);
}
}
SetPlayerArmedWeapon(playerid, GetPVarInt(playerid, "LastWeapon"));
}
stock ResetPlayerWeaponsEx(playerid)
{
ResetPlayerWeapons(playerid);
PlayerInfo[playerid][pGuns][0] = 0;
PlayerInfo[playerid][pGuns][1] = 0;
PlayerInfo[playerid][pGuns][2] = 0;
PlayerInfo[playerid][pGuns][ 3 ] = 0;
PlayerInfo[playerid][pGuns][4] = 0;
PlayerInfo[playerid][pGuns][5] = 0;
PlayerInfo[playerid][pGuns][6] = 0;
PlayerInfo[playerid][pGuns][7] = 0;
PlayerInfo[playerid][pGuns][8] = 0;
PlayerInfo[playerid][pGuns][9] = 0;
PlayerInfo[playerid][pGuns][10] = 0;
PlayerInfo[playerid][pGuns][11] = 0;
PlayerInfo[playerid][pAGuns][0] = 0;
PlayerInfo[playerid][pAGuns][1] = 0;
PlayerInfo[playerid][pAGuns][2] = 0;
PlayerInfo[playerid][pAGuns][ 3 ] = 0;
PlayerInfo[playerid][pAGuns][4] = 0;
PlayerInfo[playerid][pAGuns][5] = 0;
PlayerInfo[playerid][pAGuns][6] = 0;
PlayerInfo[playerid][pAGuns][7] = 0;
PlayerInfo[playerid][pAGuns][8] = 0;
PlayerInfo[playerid][pAGuns][9] = 0;
PlayerInfo[playerid][pAGuns][10] = 0;
PlayerInfo[playerid][pAGuns][11] = 0;
return 1;
}
RemovePlayerWeapon(playerid, weaponid)
{
new plyWeapons[13];
for(new s = 0; s < 12; s++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, s, wep, ammo);
if(wep != weaponid)
{
GetPlayerWeaponData(playerid, s, plyWeapons[s], ammo);
}
else
{
PlayerInfo[playerid][pGuns][s] = 0;
PlayerInfo[playerid][pAGuns][s] = 0;
}
}
ResetPlayerWeapons(playerid);
for(new s = 0; s < 12; s++)
{
GivePlayerValidWeapon(playerid, plyWeapons[s], 60000);
}
return 1;
}
stock GetWeaponSlot(weaponid)
{
switch(weaponid)
{
case 0, 1:
{
return 0;
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
return 1;
}
case 22, 23, 24:
{
return 2;
}
case 25, 26, 27:
{
return 3;
}
case 28, 29, 32:
{
return 4;
}
case 30, 31:
{
return 5;
}
case 33, 34:
{
return 6;
}
case 35, 36, 37, 38:
{
return 7;
}
case 16, 17, 18, 39, 40:
{
return 8;
}
case 41, 42, 43:
{
return 9;
}
case 10, 11, 12, 13, 14, 15:
{
return 10;
}
case 44, 45, 46:
{
return 11;
}
}
return -1;
}