Player loses weapons when he receives another weapon.
#1

Hey, when I perform /givegun on player he loses his current weapon and he got his new weapon.

Give gun command:
pawn Код:
COMMAND:givegun(playerid, params[])
{
    if(pInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, ERROR, ERROR_LEVEL);
    new Weapon[50], Ammo, targetID;
    if(sscanf(params, "us[50]I(500)", targetID, Weapon, Ammo)) return SendClientMessage(playerid, ERROR, USAGE_GIVEGUN);
    new Message[128], Weapons = GetWeaponID(Weapon);
    if(Weapons < 0 || Weapons > 46 || Weapons == 19 || Weapons == 20 || Weapons == 21 || Weapons == 22 || Ammo <= 500 || Ammo > 10000) return SendClientMessage(playerid, ERROR, ERROR_WEAPON);
    GivePlayerWeapon(targetID, Weapons, Ammo);
    format(Message, sizeof(Message), "You gave a '%s' to %s.", WeaponNames[Weapons], GetName(targetID));
    SendClientMessage(playerid, ABLUE, Message);
    GameTextForPlayer(targetID, "Weapon received!", 5000, 5);
    return 1;
}
That's my givegun.
Reply
#2

I wouldn't say that there is any problem in your code. Maybe you are giving player a weapon with a slot on which he has his current weapon (which has the same slot).

Check this wiki page and see the weapon slot ID's or even check your existing function which has the slot ID's.
Reply
#3

Make sure you are not giving the same type of weapon as the one the player already has.
E.g: If you give him a silenced pistol while he has a Desert Eagle, he will lose his current weapon.

Edit: Omg, just one second late...
Reply
#4

He had HS Rocker launcher and I gave him minigun.

How'd I could check that with weapon slots?
Reply
#5

HS Rocker launcher and Minigun are in the same slot. More info here.
Reply
#6

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
He had HS Rocker launcher and I gave him minigun.

How'd I could check that with weapon slots?
Would be really appreciated if you would read the replies above and actually see that your question was already answered.
Reply
#7

I thought is there any chance to have multiple weapons with same slot?
Reply
#8

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
I thought is there any chance to have multiple weapons with same slot?
I don't think something like this exist around but with a little effort it can be scripted, otherwise no.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)