Remove melee weapons?
#1

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.
Reply
#2

ResetPlayerWeapons does, though.
Reply
#3

No, ResetPlayerWeapons does not work for melee weapons
Reply
#4

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
Reply
#5

http://imgur.com/a/prfTQ

pretty sure it doesn't work, i tested it with 3 guys
Reply
#6

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
Reply
#7

Try the code I posted alone, you'll see that it does. It's most likely a problem with your script.
Reply
#8

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?
Reply
#9

Yeah, it's pretty obvious.

SetPVarInt(playerid, "iCurrentWeapon", 0);
Reply
#10

and where should i put SetPVarInt(playerid, "iCurrentWeapon", 0); ?

it works perfect with non-meele weapons
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)