Raised This Month: $ Target: $400
 0% 

Help knifes plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pentakill
Member
Join Date: Oct 2014
Old 07-26-2019 , 12:05   Help knifes plugin
Reply With Quote #1

So I have this plugin

PHP Code:
#include <amxmodx>
#include <engine>  
#include <cstrike>

#define PLUGIN "Knifes JailBreak"
#define VERSION "1.0"
#define AUTHOR "pentakill"

#define MAX_PLAYERS 32+1

new g_iKnife        [MAX_PLAYERS];

enum _:Knife
{
    
Knife_0,
    
Knife_1,
    
Knife_2,
    
Knife_3,
    
Knife_4,
    
Knife_5,
    
Knife_6,
    
Knife_7
}

new const 
g_iKnifeNome[Knife][] = 
{
    
"Normal",
    
"Knife1",
    
"Knife2",
    
"Knife3",
    
"Knife4",
    
"Knife5",
    
"Knife6",
    
"Knife7"
}

new const 
g_iKnifeModel_v[Knife][] = 
{
    
"models/models_sv/Knifetv_v.mdl",
    
"models/models_sv/tv_Knifewood_v.mdl",
    
"models/models_sv/tv_katana_v.mdl",
    
"models/models_sv/tv_ts_v.mdl",
    
"models/models_sv/tv_crowbar_v.mdl",
    
"models/models_sv/tv_asd_v.mdl",
    
"models/models_sv/tv_nightcrawler_v.mdl",
    
"models/models_sv/tv_terror_v.mdl"
}

new const 
g_iKnifeModel_p[Knife][] = 
{
    
"models/p_knife.mdl",
    
"models/models_sv/tv_Knifewood_p.mdl",
    
"models/models_sv/tv_katana_p.mdl",
    
"models/models_sv/tv_ts_p.mdl",
    
"models/models_sv/tv_crowbar_p.mdl",
    
"models/models_sv/tv_asd_p.mdl",
    
"models/models_sv/tv_nightcrawler_p.mdl",
    
"models/models_sv/tv_terror_p.mdl"
}

new const 
g_iKnifePrice[Knife] = 
{
    
0,
    
500,
    
1000,
    
1500,
    
2000,
    
2500,
    
3000,
    
3500
}

enum FF ( <<=)
{
    
FF_0 1,
    
FF_1,
    
FF_2,
    
FF_3,
    
FF_4,
    
FF_5,
    
FF_6,
    
FF_7
}

new 
FFg_KnifesBought[MAX_PLAYERS+1];



/* ---------------------------------------------------------*/

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /knifes""_knifes");
    
    
register_event("CurWeapon",     "_changeweapon""be""1=1");
    
}

public 
plugin_precache()
{
    for( new 
0Knifei++ )
        
precache_model(g_iKnifeModel_v[i]);
    
    for( new 
0Knifei++ )
        
precache_model(g_iKnifeModel_p[i]);
}


public 
_knifes(id)
{    
    new 
menu menu_create"\wMenu Knifes""_Knifeshandle" ); 
    
    static 
item[128], info[4];

    for(new 
0Knifei++ )
    {    
        if(
g_iKnifePrice[i] > 0)
        {
            if(
g_KnifesBought[id] & FF:(1<<i))
            {
                
formatex(itemsizeof(item) - 1"%s%s"g_iKnife[id] == "\d" "\w"g_iKnifeNome[i]);
            }
            else
                
formatex(itemsizeof(item) - 1"\y%i Coins \w%s",g_iKnifePrice[i], g_iKnifeNome[i]);
        }
        else 
            
formatex(itemsizeof(item) - 1"%s%s"g_iKnife[id] == "\d" "\w"g_iKnifeNome[i]);
            
        
num_to_str(iinfosizeof(info) - 1);
            
        
menu_additem(menuiteminfo);
    }
    
menu_setpropmenuMPROP_EXITMEXIT_ALL ); 
    
menu_displayidmenu); 
}

public 
_Knifeshandle(idmenuitem)
{
    if( 
item == MENU_EXIT || !is_user_connected(id) || !is_user_alive(id))
    {
        
menu_destroy(menu);
        return;
    }
    
    static 
_accessinfo[4], callback;
    
menu_item_getinfo(menuitem_accessinfosizeof(info) - 1__callback);
    
menu_destroy(menu);
    
    new 
value str_to_num(info);    
    
    if(
g_iKnife[id] == value)
    {
        
_knifes(id);
    }
    
    else if(
g_KnifesBought[id] & FF:(1<<value))
    {
        
g_iKnife[id] = value
        _giveKnife
(idvalue
    }
    
    else
    {
        
g_iKnife[id] = value
        g_KnifesBought
[id] |= FF:(1<<value)
        
_giveKnife(idvalue
    }
    
    
    return;
}

public 
_giveKnife(iditem

    
g_iKnife[id] = item
    
    
new ClipAmmoWeapon get_user_weapon(idClipAmmo)  
    if ( 
Weapon != CSW_KNIFE 
        return 
PLUGIN_HANDLED 
    
    
new vModel[56],pModel[56
    
    
format(vModel,55g_iKnifeModel_v[item]) 
    
format(pModel,55g_iKnifeModel_p[item])
    
entity_set_string(idEV_SZ_viewmodelvModel
    
entity_set_string(idEV_SZ_weaponmodelpModel
    
    return 
PLUGIN_HANDLED;   
}

public 
_changeweapon(id)
{
    
_giveKnife(idg_iKnife[id])

What I'm doing wrong? Only works buying the knife but when they change weapon, the knife disapears.
pentakill is offline
strangeguy
Senior Member
Join Date: Mar 2019
Old 08-02-2019 , 14:00   Re: Help knifes plugin
Reply With Quote #2

I have plugin with knife menu if you want I can give you.
strangeguy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-02-2019 , 15:35   Re: Help knifes plugin
Reply With Quote #3

Quote:
Originally Posted by strangeguy View Post
I have plugin with knife menu if you want I can give you.
Then why don't you give it instead of saying that you have something?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
strangeguy
Senior Member
Join Date: Mar 2019
Old 08-02-2019 , 15:56   Re: Help knifes plugin
Reply With Quote #4

Quote:
Originally Posted by pentakill View Post
So I have this plugin

PHP Code:
#include <amxmodx>
#include <engine>  
#include <cstrike>

#define PLUGIN "Knifes JailBreak"
#define VERSION "1.0"
#define AUTHOR "pentakill"

#define MAX_PLAYERS 32+1

new g_iKnife        [MAX_PLAYERS];

enum _:Knife
{
    
Knife_0,
    
Knife_1,
    
Knife_2,
    
Knife_3,
    
Knife_4,
    
Knife_5,
    
Knife_6,
    
Knife_7
}

new const 
g_iKnifeNome[Knife][] = 
{
    
"Normal",
    
"Knife1",
    
"Knife2",
    
"Knife3",
    
"Knife4",
    
"Knife5",
    
"Knife6",
    
"Knife7"
}

new const 
g_iKnifeModel_v[Knife][] = 
{
    
"models/models_sv/Knifetv_v.mdl",
    
"models/models_sv/tv_Knifewood_v.mdl",
    
"models/models_sv/tv_katana_v.mdl",
    
"models/models_sv/tv_ts_v.mdl",
    
"models/models_sv/tv_crowbar_v.mdl",
    
"models/models_sv/tv_asd_v.mdl",
    
"models/models_sv/tv_nightcrawler_v.mdl",
    
"models/models_sv/tv_terror_v.mdl"
}

new const 
g_iKnifeModel_p[Knife][] = 
{
    
"models/p_knife.mdl",
    
"models/models_sv/tv_Knifewood_p.mdl",
    
"models/models_sv/tv_katana_p.mdl",
    
"models/models_sv/tv_ts_p.mdl",
    
"models/models_sv/tv_crowbar_p.mdl",
    
"models/models_sv/tv_asd_p.mdl",
    
"models/models_sv/tv_nightcrawler_p.mdl",
    
"models/models_sv/tv_terror_p.mdl"
}

new const 
g_iKnifePrice[Knife] = 
{
    
0,
    
500,
    
1000,
    
1500,
    
2000,
    
2500,
    
3000,
    
3500
}

enum FF ( <<=)
{
    
FF_0 1,
    
FF_1,
    
FF_2,
    
FF_3,
    
FF_4,
    
FF_5,
    
FF_6,
    
FF_7
}

new 
FFg_KnifesBought[MAX_PLAYERS+1];



/* ---------------------------------------------------------*/

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /knifes""_knifes");
    
    
register_event("CurWeapon",     "_changeweapon""be""1=1");
    
}

public 
plugin_precache()
{
    for( new 
0Knifei++ )
        
precache_model(g_iKnifeModel_v[i]);
    
    for( new 
0Knifei++ )
        
precache_model(g_iKnifeModel_p[i]);
}


public 
_knifes(id)
{    
    new 
menu menu_create"\wMenu Knifes""_Knifeshandle" ); 
    
    static 
item[128], info[4];

    for(new 
0Knifei++ )
    {    
        if(
g_iKnifePrice[i] > 0)
        {
            if(
g_KnifesBought[id] & FF:(1<<i))
            {
                
formatex(itemsizeof(item) - 1"%s%s"g_iKnife[id] == "\d" "\w"g_iKnifeNome[i]);
            }
            else
                
formatex(itemsizeof(item) - 1"\y%i Coins \w%s",g_iKnifePrice[i], g_iKnifeNome[i]);
        }
        else 
            
formatex(itemsizeof(item) - 1"%s%s"g_iKnife[id] == "\d" "\w"g_iKnifeNome[i]);
            
        
num_to_str(iinfosizeof(info) - 1);
            
        
menu_additem(menuiteminfo);
    }
    
menu_setpropmenuMPROP_EXITMEXIT_ALL ); 
    
menu_displayidmenu); 
}

public 
_Knifeshandle(idmenuitem)
{
    if( 
item == MENU_EXIT || !is_user_connected(id) || !is_user_alive(id))
    {
        
menu_destroy(menu);
        return;
    }
    
    static 
_accessinfo[4], callback;
    
menu_item_getinfo(menuitem_accessinfosizeof(info) - 1__callback);
    
menu_destroy(menu);
    
    new 
value str_to_num(info);    
    
    if(
g_iKnife[id] == value)
    {
        
_knifes(id);
    }
    
    else if(
g_KnifesBought[id] & FF:(1<<value))
    {
        
g_iKnife[id] = value
        _giveKnife
(idvalue
    }
    
    else
    {
        
g_iKnife[id] = value
        g_KnifesBought
[id] |= FF:(1<<value)
        
_giveKnife(idvalue
    }
    
    
    return;
}

public 
_giveKnife(iditem

    
g_iKnife[id] = item
    
    
new ClipAmmoWeapon get_user_weapon(idClipAmmo)  
    if ( 
Weapon != CSW_KNIFE 
        return 
PLUGIN_HANDLED 
    
    
new vModel[56],pModel[56
    
    
format(vModel,55g_iKnifeModel_v[item]) 
    
format(pModel,55g_iKnifeModel_p[item])
    
entity_set_string(idEV_SZ_viewmodelvModel
    
entity_set_string(idEV_SZ_weaponmodelpModel
    
    return 
PLUGIN_HANDLED;   
}

public 
_changeweapon(id)
{
    
_giveKnife(idg_iKnife[id])

What I'm doing wrong? Only works buying the knife but when they change weapon, the knife disapears.
http://addonszm.blogspot.com/2016/11...infe-menu.html
strangeguy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-03-2019 , 06:43   Re: Help knifes plugin
Reply With Quote #5

Quote:
Originally Posted by strangeguy View Post
That plugin is 15 times worse than the one in the thread and it doesn't even have the option to BUY a knife which is the main purpose of the thread.

Also, for you, use this instead of that crap.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
pentakill
Member
Join Date: Oct 2014
Old 08-08-2019 , 11:57   Re: Help knifes plugin
Reply With Quote #6

Already fixed it, thanks!
pentakill is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode