Problem with serverside giveweapon
#1

FIXED - forgot to use ResetPlayerWeapons before giveweapon(playerid);


Hello,

This is a major problem with my server at the moment and I can't think of any way of resolving it.

Basically, I have a server side weapon system, and below is the 'giveweapon' code.

pawn Код:
forward giveweapon(playerid);
public giveweapon(playerid)
{
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon1], PlayerInfo[playerid][Ammo1]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon2], PlayerInfo[playerid][Ammo2]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon3], PlayerInfo[playerid][Ammo3]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon4], PlayerInfo[playerid][Ammo4]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon5], PlayerInfo[playerid][Ammo5]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon6], PlayerInfo[playerid][Ammo6]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon7], PlayerInfo[playerid][Ammo7]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon8], PlayerInfo[playerid][Ammo8]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon9], PlayerInfo[playerid][Ammo9]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon10], PlayerInfo[playerid][Ammo10]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon11], PlayerInfo[playerid][Ammo11]);
    GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon12], PlayerInfo[playerid][Ammo12]);
}
Here is (an example of) where the code will have problems:

pawn Код:
// the buying a baseball bat code (for example)

PlayerInfo[playerid][Weapon1] = 5;
PlayerInfo[playerid][Ammo1] = 1;
giveweapon(playerid);
The giveweapon function seems to double the ammo of the weapons.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)