Raised This Month: $ Target: $400
 0% 

Problem on my plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 06-20-2014 , 11:07   Re: Problem on my plugin
Reply With Quote #1

Quote:
Originally Posted by Flick3rR View Post
Uhm, you have some unknown read_data(2) everywhere in the clcmd function. I guess this is the problem...
Maybe you can fix my plugin because i dont know how to fix my plugin!?
please...
Eviatar Mor is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-21-2014 , 02:30   Re: Problem on my plugin
Reply With Quote #2

Quote:
Originally Posted by Eviatar Mor View Post
Maybe you can fix my plugin because i dont know how to fix my plugin!?
please...
As I can see, you don't understand very well what you are doing.

1.
PHP Code:
register_event("CurWeapon""Event_CurWeapon""be""1=1"); 
You have to use this, if not weapon model will reset. Search more about this event on wiki,inc files provided with amxmodx or here.

2. Another thing that I don't understand is why you set default models when he press "Normal".

3. Also cache get_user_weapon ( index ) so you won't check it so many times.

4. Your code won't work correctly,because you are not understanding what you are doing.

Flick3rR you guess wrong,there is no unknow read_data ( 2 ).

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

new boolHasCustomWeaponsModel 33 ]

public 
plugin_precache(){
    
precache_model("models/HNSmodelsBySerMajor/v_knife.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_knife.mdl")
    
precache_model("models/HNSmodelsBySerMajor/v_hegrenade.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_hegrenade.mdl")
    
precache_model("models/HNSmodelsBySerMajor/v_flashbang.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_flashbang.mdl")
    
precache_model("models/HNSmodelsBySerMajor/v_smokegrenade.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_smokegrenade.mdl")
}

public 
plugin_init() {
    
register_plugin("HnsMdlMod""1.0""SerMajor")
    
register_clcmd("say /hnsmdl""MenuShow")
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1");
}



public 
MenuShow(id)
{
    new 
menu menu_create("Hns Model Menu By SerMajor""MenuHandler"// ?????? , MenuHandler ?????.
    
menu_additem(menu"        Hns""1"0)
    
menu_additem(menu"Normal""2"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu0)
}

public 
MenuHandler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], szName[33];
    new 
accescallback;
    
menu_item_getinfo(menuitemaccesdata,charsmax(data), szName,charsmax(szName), callback)
    new 
key str_to_num(data);
    switch(
key)
    {
        
        case 
1: {
            
            
HasCustomWeaponsModel  id ] = true
            client_print
(idprint_chat"You Do The HNS Models!")
        }
        
        case 
2: {
            
            
client_print(idprint_chat"You DO The Normal Models!")
            return 
1;
            
        }
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
Event_CurWeapon id ) {
    
    new 
weapon get_user_weapon id )
    
    if ( ! 
HasCustomWeaponsModel id ] )
        return 
    
    switch ( 
weapon ) {
        
        case 
CSW_KNIFE : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_knife.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_knife.mdl")
            
        }
        
        case 
CSW_HEGRENADE : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_hegrenade.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_hegrenade.mdl")
            
            
        }
        
        case 
CSW_FLASHBANG : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_flashbang.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_flashbang.mdl")
            
        }
        
        case 
CSW_SMOKEGRENADE : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_smokegrenade.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_smokegrenade.mdl")
            
        }
        
        
    }
    

Try this....

Last edited by HamletEagle; 06-21-2014 at 02:30.
HamletEagle is offline
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 06-21-2014 , 07:35   Re: Problem on my plugin
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
As I can see, you don't understand very well what you are doing.

1.
PHP Code:
register_event("CurWeapon""Event_CurWeapon""be""1=1"); 
You have to use this, if not weapon model will reset. Search more about this event on wiki,inc files provided with amxmodx or here.

2. Another thing that I don't understand is why you set default models when he press "Normal".

3. Also cache get_user_weapon ( index ) so you won't check it so many times.

4. Your code won't work correctly,because you are not understanding what you are doing.

Flick3rR you guess wrong,there is no unknow read_data ( 2 ).

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

new boolHasCustomWeaponsModel 33 ]

public 
plugin_precache(){
    
precache_model("models/HNSmodelsBySerMajor/v_knife.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_knife.mdl")
    
precache_model("models/HNSmodelsBySerMajor/v_hegrenade.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_hegrenade.mdl")
    
precache_model("models/HNSmodelsBySerMajor/v_flashbang.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_flashbang.mdl")
    
precache_model("models/HNSmodelsBySerMajor/v_smokegrenade.mdl")
    
precache_model("models/HNSmodelsBySerMajor/p_smokegrenade.mdl")
}

public 
plugin_init() {
    
register_plugin("HnsMdlMod""1.0""SerMajor")
    
register_clcmd("say /hnsmdl""MenuShow")
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1");
}



public 
MenuShow(id)
{
    new 
menu menu_create("Hns Model Menu By SerMajor""MenuHandler"// ?????? , MenuHandler ?????.
    
menu_additem(menu"        Hns""1"0)
    
menu_additem(menu"Normal""2"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu0)
}

public 
MenuHandler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], szName[33];
    new 
accescallback;
    
menu_item_getinfo(menuitemaccesdata,charsmax(data), szName,charsmax(szName), callback)
    new 
key str_to_num(data);
    switch(
key)
    {
        
        case 
1: {
            
            
HasCustomWeaponsModel  id ] = true
            client_print
(idprint_chat"You Do The HNS Models!")
        }
        
        case 
2: {
            
            
client_print(idprint_chat"You DO The Normal Models!")
            return 
1;
            
        }
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
Event_CurWeapon id ) {
    
    new 
weapon get_user_weapon id )
    
    if ( ! 
HasCustomWeaponsModel id ] )
        return 
    
    switch ( 
weapon ) {
        
        case 
CSW_KNIFE : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_knife.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_knife.mdl")
            
        }
        
        case 
CSW_HEGRENADE : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_hegrenade.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_hegrenade.mdl")
            
            
        }
        
        case 
CSW_FLASHBANG : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_flashbang.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_flashbang.mdl")
            
        }
        
        case 
CSW_SMOKEGRENADE : {
            
            
set_pev(idpev_viewmodel2"models/HNSmodelsBySerMajor/v_smokegrenade.mdl")
            
set_pev(idpev_weaponmodel2"models/HNSmodelsBySerMajor/p_smokegrenade.mdl")
            
        }
        
        
    }
    

Try this....
hamelteagle the mod work great but when i try default models is just stay on hns models he not equip to default.
and again sorry about my bad english.
Eviatar Mor 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 21:11.


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