Raised This Month: $51 Target: $400
 12% 

Solved redeploy knife


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 04-08-2022 , 01:38   redeploy knife
Reply With Quote #1

After changing knife model. we need to manually redeploy knife to see changes. Is there any way to do this automatically?
PHP Code:
public Ham_Knife_Deploy_Post(iEnt)
{
    static 
idid get_pdata_cbase(iEntm_pPlayer4)
    
    if(!
g_bot[id] && g_connected[id] || g_bot[id] && g_botsWithRandomKnives)
    {
        
refreshKnifeModel(id)
    }
    
    return 
HAM_IGNORED
}

refreshKnifeModel(id)
{
    static 
indexindex g_selectedKnife[id]
    
    
set_pev(idpev_viewmodel2g_models[index][v_model])
    
set_pev(idpev_weaponmodel2g_models[index][p_model])
}

// knife choose from menu:

public ck_menu(id)
{
    new 
menuszLine[MAX_RESOURCE_PATH_LENGTH]
    
formatex(szLinecharsmax(szLine), "\yChoose knife:")
    
menu menu_create(szLine"ck_menu_handler")
    
    for(new 
isizeof(g_models); i++)
    {
        
formatex(szLinecharsmax(szLine), "%s"g_models[i][name])
        
menu_additem(menuszLine)
    }
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu)
    return 
PLUGIN_HANDLED
}

public 
ck_menu_handler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    
g_selectedKnife[id] = item
    
    client_print
(idprint_chat"* Chosen ^"%s^" knife"g_models[item][name])
    
client_print(idprint_chat"* Redeploy knife to see changes")
    
    
ck_menu(id)
    return 
PLUGIN_HANDLED

__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 04-08-2022 at 23:09.
kww is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 04-08-2022 , 10:20   Re: redeploy knife
Reply With Quote #2

Quote:
Originally Posted by kww View Post
After changing knife model. we need to manually redeploy knife to see changes. Is there any way to do this automatically?
If I understood the request correctly, I believe this works, I haven't had a chance to test it.

Code:
public ck_menu_handler(id, menu, item)
{
        if(item == MENU_EXIT)
        {
                menu_destroy(menu)
                return PLUGIN_HANDLED
        }
        
        g_selectedKnife[id] = item
        
        client_print(id, print_chat, "* Chosen ^"%s^" knife", g_models[item][name])
        client_print(id, print_chat, "* Redeploy knife to see changes")
        
        if (get_user_weapon(id) == CSW_KNIFE)
                refreshKnifeModel(id)

        ck_menu(id)
        return PLUGIN_HANDLED
}
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 04-08-2022 , 23:08   Re: redeploy knife
Reply With Quote #3

Quote:
Originally Posted by iceeedr View Post
If I understood the request correctly, I believe this works, I haven't had a chance to test it.

Code:
public ck_menu_handler(id, menu, item)
{
        if(item == MENU_EXIT)
        {
                menu_destroy(menu)
                return PLUGIN_HANDLED
        }
        
        g_selectedKnife[id] = item
        
        client_print(id, print_chat, "* Chosen ^"%s^" knife", g_models[item][name])
        client_print(id, print_chat, "* Redeploy knife to see changes")
        
        if (get_user_weapon(id) == CSW_KNIFE)
                refreshKnifeModel(id)

        ck_menu(id)
        return PLUGIN_HANDLED
}
It is. Thank you
P.s. I was so stupid to notice that
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 04-08-2022 at 23:09.
kww 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 00:32.


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