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

Help With vip model menu


Post New Thread Reply   
 
Thread Tools Display Modes
Gooday
Junior Member
Join Date: Jan 2024
Old 02-06-2024 , 07:18   Re: Help With vip model menu
Reply With Quote #31

Quote:
Originally Posted by Tote View Post
Yes, because you need to put Ham_Spawn function and to make some checks if player had model or not.

e.g:
new had_model[33];

if(had_model[id] == 1) | 1 means the model number 1
{
cs_set_user_model(id, "themodel")
}
else if(had_model[id] == x) | X = Number
{
cs_set-user_model(id, "X") | X = model Name
}

EDIT: You will also have to make A team check to avoid wrong models for wrong teams
Hmm, doesn't work for me, I guess I did something wrong ,
PHP Code:
#include < amxmodx > 
#include < cstrike > 
#include <hamsandwich>

#define PLUGIN "Player Model Menu" 
#define VERSION "1.0" 
#define AUTHOR "Supremache" 

#if !defined client_disconnected
    #define client_disconnected client_disconnect
#endif



enum _:eModelsInfo {
    
Flag,
    
CTModel[32],
    
TModel[32]
};

new const 
eModels[][ eModelsInfo ] = {
/*    <Access Flags>, <CT Model>, <T Model>    */
    
ADMIN_LEVEL_G"gign""shadow_ct"},
    { 
ADMIN_LEVEL_G"gign""cj_player"}
}

new 
g_iModel[33]
new 
had_model[33]

public 
plugin_init()

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd"say /model""@OnCustomMenu" ); 
    
RegisterHam(Ham_Spawn,"player","playerSpawn");
}

public 
client_disconnected(id)
{
    
g_iModel[id] = 0;
}

public 
plugin_precache() 
{
    for(new 
isizeofeModels ); i++) 
    {
        
PrecacheModel(eModels[i][TModel])
        
PrecacheModel(eModels[i][CTModel])
    }
}

PrecacheModel(szModel[])
{
    static 
szBuffer[128]
    
formatex(szBuffercharsmax(szBuffer), "models/player/%s/%s.mdl"szModelszModel);
    
precache_model(szBuffer);
}

@
OnCustomMenu(id)
{
    if(!
is_user_alive(id))
    {
        
client_print(idprint_chat"This is only available to alives.")
        return 
PLUGIN_HANDLED
    
}
    
    new 
iMainMenu menu_create("Select Your Skin:""@MenuHandler")
        
    for(new 
isizeofeModels ); i++) 
    {
        new 
szData[128], iFlags get_user_flags(id);
        switch(
get_user_team(id))
        {
            case 
1formatex(szDatacharsmax(szData), "%s%s"iFlags eModels[i][Flag] ? "\w" "\d"eModels[i][TModel])
            case 
2formatex(szDatacharsmax(szData), "%s%s"iFlags eModels[i][Flag] ? "\w" "\d"eModels[i][CTModel])
        }
        
menu_additem(iMainMenuszData"")
    }
    
    
menu_setprop(iMainMenuMPROP_BACKNAME"Previous page")
    
menu_setprop(iMainMenuMPROP_NEXTNAME"Next page")
    
menu_setprop(iMainMenuMPROP_EXITNAME"\rClose")
        
    
menu_setprop(iMainMenuMPROP_EXITMEXIT_ALL)
    
menu_display(idiMainMenu)
    return 
PLUGIN_HANDLED
}

@
MenuHandler(idiMenuiItem)
{
    if(
iItem != MENU_EXIT
    {
        new 
iAccessiCallBackszDate[11], iFlags get_user_flags(id);
        
menu_item_getinfo(iMenuiItemiAccessszDatecharsmax(szDate), __iCallBack);
        
        if( 
iFlags eModels[iItem][Flag] ) 
        {
            switch(
get_user_team(id))
            {
                case 
1:
                {
                    
cs_set_user_modelideModels[iItem][TModel]);
                    
client_print(idprint_chat"You received the model %s."eModels[iItem][TModel])
                }
                case 
2:
                {
                    
cs_set_user_modelideModels[iItem][CTModel]);
                    
client_print(idprint_chat"You received the model %s."eModels[iItem][CTModel])
                }
            }
            
g_iModel[id] = iItem;
        }
        else 
client_print(idprint_chat"You dont have access to select this model.")
        
    }
                
    
menu_destroy(iMenu)
    return 
PLUGIN_HANDLED




public 
playerSpawn(id)
{
    if(
had_model[id] == 1
    {
        
cs_set_user_model(id"shadow_ct")
    }
    else if(
had_model[id] == 2
    {
        
cs_set_user_model(id"cj_player"
    }

I added to public plugin_init()
PHP Code:
RegisterHam(Ham_Spawn,"player","playerSpawn"); 
and than created a function
PHP Code:
public playerSpawn(id)
{
    if(
had_model[id] == 1
    {
        
cs_set_user_model(id"shadow_ct")
    }
    else if(
had_model[id] == 2
    {
        
cs_set_user_model(id"cj_player"
    }

Gooday is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 02-06-2024 , 21:05   Re: Help With vip model menu
Reply With Quote #32

Use other plugins
__________________
amirwolf 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 04:47.


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