Raised This Month: $ Target: $400
 0% 

Knife skins (Menu)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bloody806
Member
Join Date: Jun 2012
Location: Czech Republic
Old 02-25-2013 , 08:12   Knife skins (Menu)
Reply With Quote #1

Hi i have Knife menu and in game doesnt work.

Shows no error (log,console) and I can normally compile.

Here is plugin pls heslp me I dont know how it fix.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>

new     g_SKIN33 ],
    
g_SKIN133 ],
    
g_SKIN233 ],
    
g_SKIN333 ],
    
g_SKIN433 ],
    
g_SKIN533 ],
    
g_SKIN633 ],
    
g_SKIN733 ],
    
g_SKIN833 ],
    
g_SKIN933 ],
    
g_SKIN1033 ],
    
turnOn33 ]

new const 
default_skin_v[] = "models/v_knife.mdl" 
new const default_skin_p[] = "models/p_knife.mdl"

new const skin1_v[] = "models/anathrax/dorex/v_knife.mdl" 
static const SKIN1    [ ] = "Dorex Knife"

new const skin2_v[] = "models/anathrax/lightning/v_knife.mdl" 
static const SKIN2    [ ] = "Lightning Knife"

new const skin3_v[] = "models/anathrax/master/v_knife.mdl" 
static const SKIN3    [ ] = "Master Knife"

new const skin4_v[] = "models/anathrax/traker/v_knife.mdl" 
static const SKIN4    [ ] = "Traker Knife"

new const skin5_v[] = "models/anathrax/ultimate/v_knife.mdl" 
static const SKIN5    [ ] = "Ultimate Knife"

new const skin6_v[] = "models/anathrax/ice/v_knife.mdl" 
static const SKIN6    [ ] = "Ice Knife"

new const skin7_v[] = "models/anathrax/bloody/v_knife.mdl" 
static const SKIN7    [ ] = "Bloody Knife"

new const skin8_v[] = "models/anathrax/evolution/v_knife.mdl" 
static const SKIN8    [ ] = "Evolution Knife"

new const skin9_v[] = "models/anathrax/simple/v_knife.mdl" 
static const SKIN9    [ ] = "Simple Knife"

new const skin10_v[] = "models/anathrax/crool/v_knife.mdl" 
static const SKIN10    [ ] = "Crool Knife"

static const PORTAL    [ ] = "^4[aNathrax-team.eu]^1"
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const NONVIP    [ ] = "You cant buy this skin , You are not ^3VIP ^1!"
static const BUY    [ ] = "You bought ^3"

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS"

#define NAZEV_PORTALU "aNathrax-Team.eu"
#define VIP_FLAG ADMIN_LEVEL_H


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /shop""cmd_shop")
    
register_clcmd("say /aktiv""cmd_aktiv")
    
register_clcmd("say /knife""cmd_knife")

    
register_message(get_user_msgid("SayText"),"handleSayText");
}

public 
plugin_precache()
{
    
precache_model(skin1_v)
    
precache_model(skin2_v)
    
precache_model(skin3_v)
    
precache_model(skin4_v)
    
precache_model(skin5_v)
    
precache_model(skin6_v)
    
precache_model(skin7_v)
    
precache_model(skin8_v)
    
precache_model(skin9_v)
    
precache_model(skin10_v)
}
    
public 
client_putinserver(id)
{
    
turnOn[id] = 1
    
    g_SKIN
[id]  = 0
    g_SKIN1
[id] = 0
    g_SKIN2
[id] = 0
    g_SKIN3
[id] = 0
    g_SKIN4
[id] = 0
    g_SKIN5
[id] = 0
    g_SKIN6
[id] = 0
    g_SKIN7
[id] = 0
    g_SKIN8
[id] = 0
    g_SKIN9
[id] = 0
    g_SKIN10
[id] = 0
}

public 
cmd_aktiv(id)
{
    
turnOn[id] = 1
}

public 
cmd_shop(id)
{
    if(
is_user_alive(id))
    {
        new 
directory menu_create(NAZEV_PORTALU "cmd_shop_h")
        
        
menu_additem(directory"Select your knife""1")
        
menu_addblank(directory1)
        
menu_addblank(directory1)
        
menu_additem(directory"Do not show again""2")
        
menu_additem(directory"Exit""3")
    }
    else
    {
        
ChatColor(id"%s %s"PORTAL, DIE)
    }
}

public 
cmd_shop_h(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_CONTINUE
    
}
    
    switch(
item)
    {
        case 
0:
        {
            
cmd_knife(id)
        }
        
        case 
1:
        {
            
turnOn[id] = 0
        
}
    }
    return 
PLUGIN_HANDLED
}

public 
cmd_knife(id)
{
    if(
is_user_alive(id))
    {
        new 
knife menu_create("Select your Knife""cmd_knife_h")
        
        
menu_additem(knife"Default Knife \r[0$]")
        
menu_additem(knife"%s \r[5$]",SKIN1)
        
menu_additem(knife"%s \r[5$]",SKIN2)
        
menu_additem(knife"%s \r[5$]",SKIN3)
        
menu_additem(knife"%s \r[5$]",SKIN4)
        
menu_additem(knife"%s \r[5$]",SKIN5)
        
menu_additem(knife"%s \r[10$] \y[VIP]",SKIN6)
        
menu_additem(knife"%s \r[10$] \y[VIP]",SKIN7)
        
menu_additem(knife"%s \r[15$] \y[VIP]",SKIN8)
        
menu_additem(knife"%s \r[15$] \y[VIP]",SKIN9)
        
menu_additem(knife"%s \r[15$] \y[VIP]",SKIN10)
    }
    else
    {
        
ChatColor(id"%s %s"PORTAL, DIE)
    }
}
    
public 
cmd_knife_h(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_CONTINUE
    
}
    
    switch(
item)
    {
        case 
0:
        {
            if(
read_data(2) == CSW_KNIFE)
            {
                
g_SKIN[id]  = 1
                g_SKIN1
[id] = 0
                g_SKIN2
[id] = 0
                g_SKIN3
[id] = 0
                g_SKIN4
[id] = 0
                g_SKIN5
[id] = 0
                g_SKIN6
[id] = 0
                g_SKIN7
[id] = 0
                g_SKIN8
[id] = 0
                g_SKIN9
[id] = 0
                g_SKIN10
[id] = 0
                
                set_pev
(idpev_viewmodel2default_skin_v)
                
set_pev(idpev_weaponmodel2default_skin_p)
                
                
ChatColor(id"%s %s default"PORTALBUY)
            }
        }
        
        case 
1:
        {
            if(
cs_get_user_money(id) > 5)
            {
                if(
read_data(2) == CSW_KNIFE)
                {
                    
g_SKIN[id]  = 0
                    g_SKIN1
[id] = 1
                    g_SKIN2
[id] = 0
                    g_SKIN3
[id] = 0
                    g_SKIN4
[id] = 0
                    g_SKIN5
[id] = 0
                    g_SKIN6
[id] = 0
                    g_SKIN7
[id] = 0
                    g_SKIN8
[id] = 0
                    g_SKIN9
[id] = 0
                    g_SKIN10
[id] = 0
                    
                    set_pev
(idpev_viewmodel2skin1_v)
                    
cs_set_user_money(idcs_get_user_money(id) - 5)
                    
                    
ChatColor(id"%s %s %s"PORTALBUYSKIN1)
                }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
2:
        {
            if(
cs_get_user_money(id) > 5)
            {
                if(
read_data(2) == CSW_KNIFE)
                {
                    
g_SKIN[id]  = 0
                    g_SKIN1
[id] = 0
                    g_SKIN2
[id] = 1
                    g_SKIN3
[id] = 0
                    g_SKIN4
[id] = 0
                    g_SKIN5
[id] = 0
                    g_SKIN6
[id] = 0
                    g_SKIN7
[id] = 0
                    g_SKIN8
[id] = 0
                    g_SKIN9
[id] = 0
                    g_SKIN10
[id] = 0
                    
                    set_pev
(idpev_viewmodel2skin2_v)
                    
cs_set_user_money(idcs_get_user_money(id) - 5)
                    
                    
ChatColor(id"%s %s %s"PORTALBUYSKIN2)
                }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
3:
        {    
            if(
cs_get_user_money(id) > 5)
            {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 1
                        g_SKIN4
[id] = 0
                        g_SKIN5
[id] = 0
                        g_SKIN6
[id] = 0
                        g_SKIN7
[id] = 0
                        g_SKIN8
[id] = 0
                        g_SKIN9
[id] = 0
                        g_SKIN10
[id] = 0
                            
                        set_pev
(idpev_viewmodel2skin3_v)
                        
                        
cs_set_user_money(idcs_get_user_money(id) - 5)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN3)
                    }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
4:
        {
            if(
cs_get_user_money(id) > 5)
            {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 0
                        g_SKIN4
[id] = 1
                        g_SKIN5
[id] = 0
                        g_SKIN6
[id] = 0
                        g_SKIN7
[id] = 0
                        g_SKIN8
[id] = 0
                        g_SKIN9
[id] = 0
                        g_SKIN10
[id] = 0
                        
                        set_pev
(idpev_viewmodel2skin4_v)
                        
cs_set_user_money(idcs_get_user_money(id) - 5)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN4)
                    }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
5:
        {
            if(
cs_get_user_money(id) > 5)
            {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 0
                        g_SKIN4
[id] = 0
                        g_SKIN5
[id] = 1
                        g_SKIN6
[id] = 0
                        g_SKIN7
[id] = 0
                        g_SKIN8
[id] = 0
                        g_SKIN9
[id] = 0
                        g_SKIN10
[id] = 0
                        
                        set_pev
(idpev_viewmodel2skin5_v)                        
                        
cs_set_user_money(idcs_get_user_money(id) - 5)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN5)
                    }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
6:
        {
            if(
cs_get_user_money(id) > 10)
            {
                if(
get_user_flags(id) & VIP_FLAG)
                {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 0
                        g_SKIN4
[id] = 0
                        g_SKIN5
[id] = 0
                        g_SKIN6
[id] = 1
                        g_SKIN7
[id] = 0
                        g_SKIN8
[id] = 0
                        g_SKIN9
[id] = 0
                        g_SKIN10
[id] = 0
                        
                        set_pev
(idpev_viewmodel2skin6_v)
                        
cs_set_user_money(idcs_get_user_money(id) - 10)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN6)
                    }
                }
                else
                {
                    
ChatColor(id"%s %s"PORTALNONVIP)
                }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
7:
        {
            if(
cs_get_user_money(id) > 10)
            {
                if(
get_user_flags(id) & VIP_FLAG)
                {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 0
                        g_SKIN4
[id] = 0
                        g_SKIN5
[id] = 0
                        g_SKIN6
[id] = 0
                        g_SKIN7
[id] = 1
                        g_SKIN8
[id] = 0
                        g_SKIN9
[id] = 0
                        g_SKIN10
[id] = 0
                        
                        set_pev
(idpev_viewmodel2skin7_v)
                        
                        
cs_set_user_money(idcs_get_user_money(id) - 10)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN7)
                    }
                }
                else
                {
                    
ChatColor(id"%s %s"PORTALNONVIP)
                }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
8:
        {
            if(
cs_get_user_money(id) > 15)
            {
                if(
get_user_flags(id) & VIP_FLAG)
                {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 0
                        g_SKIN4
[id] = 0
                        g_SKIN5
[id] = 0
                        g_SKIN6
[id] = 0
                        g_SKIN7
[id] = 0
                        g_SKIN8
[id] = 1
                        g_SKIN9
[id] = 0
                        g_SKIN10
[id] = 0
                        
                        set_pev
(idpev_viewmodel2skin8_v)
                        
cs_set_user_money(idcs_get_user_money(id) - 15)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN8)
                    }
                }
                else
                {
                    
ChatColor(id"%s %s"PORTALNONVIP)
                }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
        
        case 
9:
        {
            if(
cs_get_user_money(id) > 15)
            {
                if(
get_user_flags(id) & VIP_FLAG)
                {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 0
                        g_SKIN4
[id] = 0
                        g_SKIN5
[id] = 0
                        g_SKIN6
[id] = 0
                        g_SKIN7
[id] = 0
                        g_SKIN8
[id] = 0
                        g_SKIN9
[id] = 1
                        g_SKIN10
[id] = 0
                        
                        set_pev
(idpev_viewmodel2skin9_v)
                        
                        
cs_set_user_money(idcs_get_user_money(id) - 15)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN9)
                    }
                }
                else
                {
                    
ChatColor(id"%s %s"PORTALNONVIP)
                }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
                }
        }
        
        case 
10:
        {
            if(
cs_get_user_money(id) > 15)
            {
                if(
get_user_flags(id) & VIP_FLAG)
                {
                    if(
read_data(2) == CSW_KNIFE)
                    {
                        
                        
g_SKIN[id]  = 0
                        g_SKIN1
[id] = 0
                        g_SKIN2
[id] = 0
                        g_SKIN3
[id] = 0
                        g_SKIN4
[id] = 0
                        g_SKIN5
[id] = 0
                        g_SKIN6
[id] = 0
                        g_SKIN7
[id] = 0
                        g_SKIN8
[id] = 0
                        g_SKIN9
[id] = 0
                        g_SKIN10
[id] = 1
                        
                        set_pev
(idpev_viewmodel2skin10_v)
                        
cs_set_user_money(idcs_get_user_money(id) - 15)
                        
                        
ChatColor(id"%s %s %s"PORTALBUYSKIN10)
                    }
                }
                else
                {
                    
ChatColor(id"%s %s"PORTALNONVIP)
                }
            }
            else
            {
                
ChatColor(id"%s %s"PORTALMONEY)
            }
        }
    }
    return 
PLUGIN_HANDLED
}
    
stock ChatColor(const id, const input[], any:...) {
     new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)
    
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )

    
    if(
idplayers] = id; else get_playersplayerscount"ch" )
    {
        for(new 
0counti++)
        {
            if( 
is_user_connectedplayers] ) )
            {
                
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
                
write_byteplayers] )
                
write_stringmsg )
                
message_end( )
            }
        }
    }


Last edited by bloody806; 02-25-2013 at 08:20.
bloody806 is offline
Send a message via Skype™ to bloody806
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 02-26-2013 , 03:15   Re: Knife skins (Menu)
Reply With Quote #2

first of all you're not using your arrays. (g_SKIN, g_SKIN1, ,,, g_SKIN10). You may also delete them.
and another thing. you have 11 cases (0-10 = 11) with just 10 keyboard numbers.

and please what doesn't work ? the menu doesnt' work, it doesn't change the model or what ? be specific.
EDUTz is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 02-26-2013 , 04:52   Re: Knife skins (Menu)
Reply With Quote #3

The whole code is very bad.

Wrong using pev_viewmodel - After switch to weapon and back to knife the skin will be returned to the default skin. The fix is to use the CurWeapon event, so the model will update after every switch.

I'm rebuilding the code now
__________________
simanovich is offline
bloody806
Member
Join Date: Jun 2012
Location: Czech Republic
Old 02-26-2013 , 06:07   Re: Knife skins (Menu)
Reply With Quote #4

Quote:
Originally Posted by EDUTz View Post
first of all you're not using your arrays. (g_SKIN, g_SKIN1, ,,, g_SKIN10). You may also delete them.
and another thing. you have 11 cases (0-10 = 11) with just 10 keyboard numbers.

and please what doesn't work ? the menu doesnt' work, it doesn't change the model or what ? be specific.
Commands do not work.. /shop , /aktiv , /knife
bloody806 is offline
Send a message via Skype™ to bloody806
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 02-26-2013 , 06:45   Re: Knife skins (Menu)
Reply With Quote #5

Finished rewriting the plugin. Untested.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new g_knife[33];
    
enum _:Skins{
    DEFAULT,
    
SKIN1,
    
SKIN2,
    
SKIN3,
    
SKIN4,
    
SKIN5,
    
SKIN6,
    
SKIN7,
    
SKIN8,
    
SKIN9,
    
SKIN10,    
}

new const 
g_knifemodels[Skins][64] = {
    
"models/v_knife.mdl"// The default model, don't touch
    
"models/anathrax/dorex/v_knife.mdl",
    
"models/anathrax/lightning/v_knife.mdl",
    
"models/anathrax/master/v_knife.mdl",
    
"models/anathrax/traker/v_knife.mdl",
    
"models/anathrax/ultimate/v_knife.mdl"
    
"models/anathrax/ice/v_knife.mdl",
    
"models/anathrax/bloody/v_knife.mdl",
    
"models/anathrax/evolution/v_knife.mdl"
    
"models/anathrax/simple/v_knife.mdl",
    
"models/anathrax/crool/v_knife.mdl"
}

new const 
g_knifenames [Skins][32] = {
    
"Default Knife",
    
"Dorex Knife",
    
"Lightning Knife",
    
"Master Knife",
    
"Traker Knife",
    
"Ultimate Knife",
    
"Ice Knife",
    
"Bloody Knife",
    
"Evolution Knife",
    
"Simple Knife",
    
"Crool Knife"
}

new 
g_knifecosts[Skins][] = {
    
0,
    
5,
    
5,
    
5,
    
5,
    
5,
    
10,
    
10,
    
15,
    
15,
    
15
}

new 
g_knifeflag[Skins][] = {
    
0,
    
0,
    
0,
    
0,
    
0,
    
0,
    
1,
    
1,
    
1,
    
1,
    
1
}

static const 
PORTAL    [ ] = "^4[aNathrax-team.eu]^1"
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const BUY    [ ] = "You bought ^3"

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS [Hyuna Rewrite]"

#define NAZEV_PORTALU "aNathrax-Team.eu"
#define VIP_FLAG ADMIN_LEVEL_H


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /knifeshop""cmd_knife")
    
register_clcmd("say /knife""cmd_knife")
    
    
register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public 
plugin_precache(){
    for (new 
i<= sizeof g_knifemodelsi++)
        
precache_model(g_knifemodels[i]);
}
    
public 
client_putinserver(client)
    
g_knife[client] = 0;

public 
Event_CurWeapon(client){
    
    if (
read_data(2) == CSW_KNIFE)
        
set_pev(client,pev_viewmodel2,g_knifemodels[g_knife[client]]);
    
}



public 
cmd_knife(id)
{
    new 
szSome[256];
    if(
is_user_alive(id))
    {
        new 
knife menu_create("Select your Knife""cmd_knife_h");
        new 
cb menu_makecallback("knife_callback");
        
        for (new 
i<= Skinsi++)
        {
            
formatex(szSome,255,"%s \r[%i$] \y%i",g_knifenames[i],str_to_num(g_knifecosts[i]),str_to_num(g_knifeflag[i]));
            
menu_additem(knife,szSome,g_knifeflag[i],.callback=cb);
        }    
        
        
menu_display(id,knife);
    }
    
    else
        
ChatColor(id"%s %s"PORTAL, DIE);
}

public 
knife_callback(client,knife,item){
    new 
access,callback,szInfo[8],szName[32];
    
menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
    
    if (
str_to_num(szInfo) == && !(get_user_flags(client) & VIP_FLAG))
        return 
ITEM_DISABLED;
        
    return 
ITEM_ENABLED;
}
    
public 
cmd_knife_h(clientknifeitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(knife);
        return;
    }
    
    if (
cs_get_user_money(client) < str_to_num(g_knifecosts[item]))
    {
        
ChatColor(client,"%s %s",PORTAL,MONEY);
        return;
    }
    
    
cs_set_user_money(client,(cs_get_user_money(client) - str_to_num(g_knifecosts[item])),1);
    
ChatColor(client,"%s %s%s",PORTAL,BUY,g_knifenames[g_knife[client]]);
    
g_knife[client] = item;
}
    
stock ChatColor(const id, const input[], any:...) {
    new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)
    
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )

    
    if(
idplayers] = id
    else 
get_playersplayerscount"ch" )
    
    for(new 
0counti++)
    {
        if( 
is_user_connectedplayers] ) )
        {
            
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
            
write_byteplayers] )
            
write_stringmsg )
            
message_end( )
        }
    }

__________________
simanovich is offline
bloody806
Member
Join Date: Jun 2012
Location: Czech Republic
Old 02-26-2013 , 07:46   Re: Knife skins (Menu)
Reply With Quote #6

Thanks but again commands do not work.. /knife and /knifeshop

and shows this error:
L 02/26/2013 - 13:34:26: [AMXX] Displaying debug trace (plugin "knife_shopp.amxx")
L 02/26/2013 - 13:34:26: [AMXX] Run time error 4: index out of bounds
L 02/26/2013 - 13:34:26: [AMXX] [0] knife_shopp.sma::cmd_knife (line 126)

Last edited by bloody806; 02-26-2013 at 07:48.
bloody806 is offline
Send a message via Skype™ to bloody806
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 02-26-2013 , 14:10   Re: Knife skins (Menu)
Reply With Quote #7

Quote:
Originally Posted by bloody806 View Post
Thanks but again commands do not work.. /knife and /knifeshop

and shows this error:
L 02/26/2013 - 134:26: [AMXX] Displaying debug trace (plugin "knife_shopp.amxx")
L 02/26/2013 - 134:26: [AMXX] Run time error 4: index out of bounds
L 02/26/2013 - 134:26: [AMXX] [0] knife_shopp.sma::cmd_knife (line 126)
Try now:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define SKINS 11

new g_knife[33];
    
new const 
g_knifemodels[SKINS][64] = {
    
"models/v_knife.mdl"// The default model, don't touch
    
"models/anathrax/dorex/v_knife.mdl",
    
"models/anathrax/lightning/v_knife.mdl",
    
"models/anathrax/master/v_knife.mdl",
    
"models/anathrax/traker/v_knife.mdl",
    
"models/anathrax/ultimate/v_knife.mdl"
    
"models/anathrax/ice/v_knife.mdl",
    
"models/anathrax/bloody/v_knife.mdl",
    
"models/anathrax/evolution/v_knife.mdl"
    
"models/anathrax/simple/v_knife.mdl",
    
"models/anathrax/crool/v_knife.mdl"
}

new const 
g_knifenames [SKINS][32] = {
    
"Default Knife",
    
"Dorex Knife",
    
"Lightning Knife",
    
"Master Knife",
    
"Traker Knife",
    
"Ultimate Knife",
    
"Ice Knife",
    
"Bloody Knife",
    
"Evolution Knife",
    
"Simple Knife",
    
"Crool Knife"
}

new 
g_knifecosts[SKINS][] = {
    
0,
    
5,
    
5,
    
5,
    
5,
    
5,
    
10,
    
10,
    
15,
    
15,
    
15
}

new 
g_knifeflag[SKINS][] = {
    
0,
    
0,
    
0,
    
0,
    
0,
    
0,
    
1,
    
1,
    
1,
    
1,
    
1
}

static const 
PORTAL    [ ] = "^4[aNathrax-team.eu]^1"
static const DIE    [ ] = "You can not open a shop, you must be alive !"
static const MONEY    [ ] = "You dont have money for this knife skin !"
static const BUY    [ ] = "You bought ^3"

#define PLUGIN "MultiShop - Knife server"
#define VERSION "1.0"
#define AUTHOR "SkillerkoS"

#define NAZEV_PORTALU "aNathrax-Team.eu"
#define VIP_FLAG ADMIN_LEVEL_H


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /knifeshop""cmd_knife")
    
register_clcmd("say /knife""cmd_knife")
    
    
register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public 
plugin_precache(){
    for (new 
i<= sizeof g_knifemodelsi++)
        
precache_model(g_knifemodels[i]);
}
    
public 
client_putinserver(client)
    
g_knife[client] = 0;

public 
Event_CurWeapon(client){
    
    if (
read_data(2) == CSW_KNIFE)
        
set_pev(client,pev_viewmodel2,g_knifemodels[g_knife[client]]);
    
}

public 
cmd_knife(id){
    new 
szSome[256];
    if(
is_user_alive(id))
    {
        new 
knife menu_create("Select your Knife""cmd_knife_h");
        new 
cb menu_makecallback("knife_callback");
        
        for (new 
i<= SKINS 1i++)
        {
            
formatex(szSome,255,"%s \r[%i$] \y%i",g_knifenames[i],str_to_num(g_knifecosts[i]),str_to_num(g_knifeflag[i]));
            
menu_additem(knife,szSome,g_knifeflag[i],.callback=cb);
        }    
        
        
menu_display(id,knife);
    }
    
    else
        
ChatColor(id"%s %s"PORTAL, DIE);
}

public 
knife_callback(client,knife,item){
    new 
access,callback,szInfo[8],szName[32];
    
menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
    
    if (
str_to_num(szInfo) == && !(get_user_flags(client) & VIP_FLAG))
        return 
ITEM_DISABLED;
        
    return 
ITEM_ENABLED;
}
    
public 
cmd_knife_h(clientknifeitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(knife);
        return;
    }
    
    if (
cs_get_user_money(client) < str_to_num(g_knifecosts[item]))
    {
        
ChatColor(client,"%s %s",PORTAL,MONEY);
        return;
    }
    
    
cs_set_user_money(client,(cs_get_user_money(client) - str_to_num(g_knifecosts[item])),1);
    
ChatColor(client,"%s %s%s",PORTAL,BUY,g_knifenames[g_knife[client]]);
    
g_knife[client] = item;
}
    
stock ChatColor(const id, const input[], any:...) {
    new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)
    
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )

    
    if(
idplayers] = id
    else 
get_playersplayerscount"ch" )
    
    for(new 
0counti++)
    {
        if( 
is_user_connectedplayers] ) )
        {
            
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
            
write_byteplayers] )
            
write_stringmsg )
            
message_end( )
        }
    }

__________________
simanovich is offline
bloody806
Member
Join Date: Jun 2012
Location: Czech Republic
Old 02-28-2013 , 11:47   Re: Knife skins (Menu)
Reply With Quote #8

Yes now work Thanks.. but..

This has no effect
PHP Code:
new g_knifecosts[SKINS][] = {
    
0,
    
5,
    
5,
    
5,
    
5,
    
5,
    
10,
    
10,
    
15,
    
15,
    
15
}

new 
g_knifeflag[SKINS][] = {
    
0,
    
0,
    
0,
    
0,
    
0,
    
0,
    
1,
    
1,
    
1,
    
1,
    
1

Here are screens:

Last edited by bloody806; 02-28-2013 at 11:56.
bloody806 is offline
Send a message via Skype™ to bloody806
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 02-28-2013 , 14:18   Re: Knife skins (Menu)
Reply With Quote #9

Hmmm... maybe try this:
PHP Code:
new g_knifecosts[SKINS][] = {
    
"0",
    
"5",
    
"5",
    
"5",
    
"5",
    
"5",
    
"10",
    
"10",
    
"15",
    
"15",
    
"15"
}

new 
g_knifeflag[SKINS][] = {
    
"0",
    
"0",
    
"0",
    
"0",
    
"0",
    
"0",
    
"1",
    
"1",
    
"1",
    
"1",
    
"1"

__________________
simanovich is offline
bloody806
Member
Join Date: Jun 2012
Location: Czech Republic
Old 02-28-2013 , 16:49   Re: Knife skins (Menu)
Reply With Quote #10

Im stupid now work but...


I bought a dorex knife and wrote "You bought Defaut Knife"
and I bought Simple Knife and wrote "You bought Dorex Knife"
and i Bought Ultimate Knife and wrote "You bought Simple Knife"


You can fix? Please

Last edited by bloody806; 02-28-2013 at 16:50.
bloody806 is offline
Send a message via Skype™ to bloody806
Reply



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 21:40.


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