View Single Post
ShadowRanger
Junior Member
Join Date: Aug 2017
Old 10-30-2017 , 05:34   Re: OnWeaponUse Issue
Reply With Quote #3

Quote:
Originally Posted by Headline View Post
PHP Code:
public Action OnWeaponCanUse(int clientint weapon)
{
    if (!
g_startedFunRound) return Plugin_Continue;

    if (!
IsClientInGame(client)) return Plugin_Continue;
    if (!
IsPlayerAlive(client)) return Plugin_Stop// this should return Plugin_Continue

    
if (IsValidEntity(weapon)) // This will happen any time the player's weapon is a valid weapon, is this intended behavior???
    
{
        
AcceptEntityInput(weapon"Kill"); // If you don't want them to pick the item up, return Plugin_Handled
    
}


    if (!
StrEqual(g_curRoundWeapon"weapon_knife")) // Any time this OnCanUse is called you want to give them a weapon? Why here
    
{
        
GivePlayerItem(clientg_curRoundWeapon);
    }

    return 
Plugin_Handled// Why Plugin_Handled here??

I'm not quite sure you understand the differences between Plugin_Handled, Plugin_Continue, and Plugin_Stop. Here you go.

By the way, Plugin_Stop is only used in timer callbacks
If I just return Plugin_Handled, and don't do any of the other things such as removing the dropped weapon and giving them a new weapon, whenever they walk over a weapon it creates one over it and drops it and then removes the current weapon from the player. I've got no idea why. I just want it to prevent them from picking it up and leaving them with their current weapon as well as removing the one that's created when they can't pick it up.
ShadowRanger is offline