Remove melee weapons? -
RomanianProjectCommunity - 06.09.2016
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.
Re: Remove melee weapons? -
SickAttack - 06.09.2016
ResetPlayerWeapons does, though.
Re: Remove melee weapons? -
RomanianProjectCommunity - 06.09.2016
No, ResetPlayerWeapons does not work for melee weapons
Re: Remove melee weapons? -
SickAttack - 06.09.2016
Are you sure?
pawn Код:
// ** INCLUDES
#include <a_samp>
#include <zcmd>
// ** MAIN
main()
{
print("Loaded \"blank.amx\".");
}
// ** CALLBACKS
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
// ** COMMANDS
CMD:melee(playerid)
{
GivePlayerWeapon(playerid, WEAPON_KATANA, 1);
return 1;
}
CMD:remove(playerid)
{
ResetPlayerWeapons(playerid);
return 1;
}
http://imgur.com/a/yO9oI
Re: Remove melee weapons? -
RomanianProjectCommunity - 06.09.2016
http://imgur.com/a/prfTQ
pretty sure it doesn't work, i tested it with 3 guys
Re: Remove melee weapons? -
RomanianProjectCommunity - 06.09.2016
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
Re: Remove melee weapons? -
SickAttack - 06.09.2016
Try the code I posted alone, you'll see that it does. It's most likely a problem with your script.
Re: Remove melee weapons? -
RomanianProjectCommunity - 06.09.2016
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?
Re: Remove melee weapons? -
SickAttack - 06.09.2016
Yeah, it's pretty obvious.
SetPVarInt(playerid, "iCurrentWeapon", 0);
Re: Remove melee weapons? -
RomanianProjectCommunity - 06.09.2016
and where should i put SetPVarInt(playerid, "iCurrentWeapon", 0); ?
it works perfect with non-meele weapons