View Single Post
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-29-2019 , 13:59   Re: Knife Models [XP System & Skills Support]
Reply With Quote #148

Quote:
Originally Posted by Deszzz View Post
Wassup, hey Ocixcrom, just curious here. Is there a way to make like we are able to set a knife by both LEVEL/XP and FLAG at the same time?

Something that would stay like this:

[Butterfly Fade]
V_MODEL = models/v_knife_butterfly_fade.mdl
LEVEL = 14
FLAG = l
SHOW_RANK = 1

This way, if an admin is not Level 14, he still has access to a knife as part of his admin privilegies and the knife is also available for normal players upgrading their rank.
It's possible by modifying the plugin a bit. Locate the has_knife_access function on line 631 and change it like this:

PHP Code:
bool:has_knife_access(const id, const iKnife)
{
    static 
eKnife[Knives]
    
ArrayGetArray(g_aKnivesiKnifeeKnife)

    if(
eKnife[FLAG] != ADMIN_ALL)
    {
        return !!(
get_user_flags(id) & eKnife[FLAG])
    }

    if(
g_bRankSystem)
    {
        if(
eKnife[LEVEL] && crxranks_get_user_level(id) < eKnife[LEVEL])
        {
            return 
false
        
}

        if(
eKnife[XP] && crxranks_get_user_xp(id) < eKnife[XP])
        {
            return 
false
        
}
    }

    return 
true

Now when the knife has a flag set, the plugin will check if the player has the required flag and if he does, it will ignore the XP/level check and give him access directly.

I may add this in the main plugin in a future update.
__________________

Last edited by OciXCrom; 04-29-2019 at 14:00.
OciXCrom is offline
Send a message via Skype™ to OciXCrom