Player loses weapons when he receives another weapon. -
RedJohn - 21.08.2013
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.
Re: Player loses weapons when he receives another weapon. -
Cypress - 21.08.2013
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.
Re: Player loses weapons when he receives another weapon. -
Dragonsaurus - 21.08.2013
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...
Re: Player loses weapons when he receives another weapon. -
RedJohn - 21.08.2013
He had HS Rocker launcher and I gave him minigun.
How'd I could check that with weapon slots?
Re: Player loses weapons when he receives another weapon. -
Dragonsaurus - 21.08.2013
HS Rocker launcher and Minigun are in the same slot. More info
here.
Re: Player loses weapons when he receives another weapon. -
Cypress - 21.08.2013
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.
Re: Player loses weapons when he receives another weapon. -
RedJohn - 21.08.2013
I thought is there any chance to have multiple weapons with same slot?
Re: Player loses weapons when he receives another weapon. -
Cypress - 21.08.2013
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.