Raised This Month: $ Target: $400
 0% 

[HELP] is this a fixable problem?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Heartbeat
Member
Join Date: Nov 2011
Location: Denmark
Old 11-17-2011 , 10:46   [HELP] is this a fixable problem?
Reply With Quote #1

http://**************/photo/my-images/706/snapma.jpg/


This is the full plugin..
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

new knife_model[33
new 
g_Menu 
new menuBody[512]

public 
plugin_init() 

    
register_plugin("Knife""1.0""Flaxie")
    
register_event("CurWeapon""EventCurWeapon""be""1=1"); 
     
    
g_Menu register_menuid("Knife Mod"
    
register_menucmd(g_Menu1023"knifemenu"

    
register_clcmd("amx_knifemenu""display_knife"


public 
plugin_precache() 
{  
    
precache_model("models/HB_Blockmaker2/Misc/v_katana.mdl")  
    
precache_model("models/HB_Blockmaker2/Misc/p_katana.mdl")  
    
precache_model("models/HB_Blockmaker2/Misc/v_light.mdl"
    
precache_model("models/HB_Blockmaker2/Misc/p_light.mdl"
    
precache_model("models/HB_Blockmaker2/Misc/v_proff.mdl"
    
precache_model("models/HB_Blockmaker2/Misc/p_proff.mdl"
    
precache_model("models/HB_Blockmaker2/Misc/v_moto.mdl"
    
precache_model("models/HB_Blockmaker2/Misc/p_moto.mdl"
    
precache_model("models/v_knife.mdl")  
    
precache_model("models/p_knife.mdl"


public 
display_knife(id)  
{
   new 
szArg[32];
   
read_argv(idszArg31);

   new 
iPlayer cmd_targetidszArg);

    if(
get_user_flags(iPlayer) & ADMIN_KICK)
    {
    
add(menuBody511"\w[HB] Knife Menu^nBy: \yfLaXXiE\w^n^n"
    
add(menuBody511"1. Ninja Sword \w(\yMembers Only\w)^n"
    
add(menuBody511"2. Chainsaw \w(\yMembers Only\w)^n"
    
add(menuBody511"3. Lightsaber \w(\yMembers Only\w)^n"
    
add(menuBody511"4. Pro Knife \w(\yMembers Only\w)^n"
    
add(menuBody511"5. Starter Knife\w^n^n")
    
add(menuBody511"0. Exit^n"

    new 
keys = ( 1<<1<<1<<1<<1<<1<<
        
show_menu(idkeysmenuBody, -1"Knife Mod"
    }


public 
knifemenu(idkey

    switch(
key)  
    { 
        case 
0SetKnife(id 4
        case 
1SetKnife(id 2
        case 
2SetKnife(id 3
        case 
3SetKnife(id 1
        case 
4SetKnife(id 0
        default: return 
PLUGIN_HANDLED 
    

    
SaveData(id
    return 
PLUGIN_HANDLED 
}  

public 
SetKnife(id Knife

    
knife_model[id] = Knife 
     
    
new ClipAmmoWeapon get_user_weapon(idClipAmmo)  
    if ( 
Weapon != CSW_KNIFE 
        return 
PLUGIN_HANDLED 
     
    
new vModel[56],pModel[56
     
    switch(
Knife
    { 
        case 
0: { 
            
format(vModel,55,"models/v_knife.mdl"
            
format(pModel,55,"models/p_knife.mdl"
        } 
        case 
1: { 
            
format(vModel,55,"models/HB_Blockmaker2/Misc/v_proff.mdl"
            
format(pModel,55,"models/HB_Blockmaker2/Misc/p_proff.mdl"
        } 
        case 
2: { 
            
format(vModel,55,"models/HB_Blockmaker2/Misc/v_moto.mdl"
            
format(pModel,55,"models/HB_Blockmaker2/Misc/p_moto.mdl"
        } 
        case 
3: { 
            
format(vModel,55,"models/HB_Blockmaker2/Misc/v_light.mdl"
            
format(pModel,55,"models/HB_Blockmaker2/Misc/p_light.mdl"
        } 
        case 
4: { 
            
format(vModel,55,"models/HB_Blockmaker2/Misc/v_katana.mdl"
            
format(pModel,55,"models/HB_Blockmaker2/Misc/p_katana.mdl"
        } 
    }  
     
    
entity_set_string(idEV_SZ_viewmodelvModel
    
entity_set_string(idEV_SZ_weaponmodelpModel
     
    return 
PLUGIN_HANDLED;   


public 
EventCurWeapon(id

    new 
Weapon read_data(2
     
    
SetKnife(idknife_model[id]) 
     
    return 
PLUGIN_HANDLED  


stock log_kill(killervictimweapon[],headshot

    
user_silentkillvictim ); 
     
    
message_beginMSG_ALLget_user_msgid"DeathMsg" ), {0,0,0}, ); 
    
write_bytekiller ); 
    
write_bytevictim ); 
    
write_byteheadshot ); 
    
write_stringweapon ); 
    
message_end(); 
     
    new 
kfrags get_user_fragskiller ); 
    
set_user_fragskillerkfrags++ ); 
    new 
vfrags get_user_fragsvictim ); 
    
set_user_fragsvictimvfrags++ ); 
     
    return  
PLUGIN_CONTINUE 
}  

public 
client_authorized(id

    
LoadData(id


SaveData(id

    new 
authid[32
    
get_user_authid(idauthid31
     
    new 
vaultkey[64
    new 
vaultdata[64
     
    
format(vaultkey63"KMOD_%s"authid
    
format(vaultdata63"%d"knife_model[id]) 
    
set_vaultdata(vaultkeyvaultdata


LoadData(id)  
{  
    new 
authid[32]  
    
get_user_authid(id,authid,31
     
    new 
vaultkey[64], vaultdata[64
     
    
format(vaultkey63"KMOD_%s"authid
    
get_vaultdata(vaultkeyvaultdata63
    
knife_model[id] = str_to_num(vaultdata

And it must be somthing with this part..
PHP Code:
public display_knife(id)  
{
   new 
szArg[32];
   
read_argv(idszArg31);

   new 
iPlayer cmd_targetidszArg);

    if(
get_user_flags(iPlayer) & ADMIN_KICK)
    {
    
add(menuBody511"\w[HB] Knife Menu^nBy: \yfLaXXiE\w^n^n"
    
add(menuBody511"1. Ninja Sword \w(\yMembers Only\w)^n"
    
add(menuBody511"2. Chainsaw \w(\yMembers Only\w)^n"
    
add(menuBody511"3. Lightsaber \w(\yMembers Only\w)^n"
    
add(menuBody511"4. Pro Knife \w(\yMembers Only\w)^n"
    
add(menuBody511"5. Starter Knife\w^n^n")
    
add(menuBody511"0. Exit^n"

    new 
keys = ( 1<<1<<1<<1<<1<<1<<
        
show_menu(idkeysmenuBody, -1"Knife Mod"
    }


Last edited by Heartbeat; 11-17-2011 at 10:50.
Heartbeat is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 11-17-2011 , 12:09   Re: [HELP] is this a fixable problem?
Reply With Quote #2

Try do it with other sort of menu.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
Heartbeat
Member
Join Date: Nov 2011
Location: Denmark
Old 11-17-2011 , 12:10   Re: [HELP] is this a fixable problem?
Reply With Quote #3

Can you help me do that?
Heartbeat is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 11-17-2011 , 12:23   Re: [HELP] is this a fixable problem?
Reply With Quote #4

Look for tutorials. We don't have to do the work for you. Search. If you want to it be done for you post it in suggestions/requests.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-18-2011 , 00:41   Re: [HELP] is this a fixable problem?
Reply With Quote #5

I'm guessing that menuBody is a global variable. If the menu never changes you need to build the menu once and only once (in plugin_init or plugin_cfg). Then you just show it when you need it.
__________________
fysiks is offline
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 08:23.


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