Posts: 9
Threads: 1
Joined: Feb 2013
Reputation:
0
Hello, it seems that ResetPlayerWeapons or SetPlayerAmmo won't effect melee weapons.
How can i remove them? I want the player to not have them when they write a command.
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
ResetPlayerWeapons does, though.
Posts: 9
Threads: 1
Joined: Feb 2013
Reputation:
0
No, ResetPlayerWeapons does not work for melee weapons
Posts: 9
Threads: 1
Joined: Feb 2013
Reputation:
0
new iCurWeap = GetPlayerWeapon(playerid),ammo = GetPlayerAmmo(playerid); // Return the player's current weapon
if(iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // If he changed weapons since the last update
{
OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), ammo);
//SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Update the weapon variable
}
stock OnPlayerChangeWeapon(playerid, oldweapon, ammo)
{
if(oldweapon)GivePlayerWeapon(playerid,oldweapon,a mmo);
}
i think the problem could be this, because i don't let players to have more than one weapon in their inventory.. but the problem is only with the melee weapons
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
Try the code I posted alone, you'll see that it does. It's most likely a problem with your script.
Posts: 9
Threads: 1
Joined: Feb 2013
Reputation:
0
Yes, it works that way. Now i have to check the script i posted above, because that's the problem.
Do you have any idea why that script works only with non-melee weapons?
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
Yeah, it's pretty obvious.
SetPVarInt(playerid, "iCurrentWeapon", 0);
Posts: 9
Threads: 1
Joined: Feb 2013
Reputation:
0
and where should i put SetPVarInt(playerid, "iCurrentWeapon", 0); ?
it works perfect with non-meele weapons