Raised This Month: $32 Target: $400
 8% 

VIP skin menu help


Post New Thread Reply   
 
Thread Tools Display Modes
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-21-2020 , 18:56   Re: VIP skin menu help
Reply With Quote #11

Quote:
Originally Posted by iclassdon View Post
The skins isn't staying on after you die or when round ends. Needs to be reapplied on respawn. Anyway to fix this?
PHP Code:
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1
PHP Code:
public OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        static 
bool:bMatchiFlagsi
        bMatch 
false
        
        
for(iFlags get_user_flags(id), 0sizeof(g_eModels); i++)
        {
            if(
iFlags g_eModels[i][Flag])
            {
                switch(
cs_get_user_team(id))
                {
                    case 
CS_TEAM_CTcs_set_user_model(idg_eModels[i][CTModel])
                    case 
CS_TEAM_Tcs_set_user_model(idg_eModels[i][TModel])
                }
                
                
bMatch true
                
break
            }
        }
        
        if(!
bMatch)
        {
            static 
szModel[32]
            
cs_get_user_model(idszModelcharsmax(szModel))
            
            if(
TrieKeyExists(g_tModelsszModel))
                
cs_reset_user_model(id)
        }
    }


Last edited by Supremache; 04-21-2020 at 19:00.
Supremache is offline
iclassdon
AlliedModders Donor
Join Date: May 2006
Old 04-21-2020 , 19:49   Re: VIP skin menu help
Reply With Quote #12

Quote:
Originally Posted by Supremache View Post
PHP Code:
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1
PHP Code:
public OnPlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        static 
bool:bMatchiFlagsi
        bMatch 
false
        
        
for(iFlags get_user_flags(id), 0sizeof(g_eModels); i++)
        {
            if(
iFlags g_eModels[i][Flag])
            {
                switch(
cs_get_user_team(id))
                {
                    case 
CS_TEAM_CTcs_set_user_model(idg_eModels[i][CTModel])
                    case 
CS_TEAM_Tcs_set_user_model(idg_eModels[i][TModel])
                }
                
                
bMatch true
                
break
            }
        }
        
        if(!
bMatch)
        {
            static 
szModel[32]
            
cs_get_user_model(idszModelcharsmax(szModel))
            
            if(
TrieKeyExists(g_tModelsszModel))
                
cs_reset_user_model(id)
        }
    }

Not sure what to do with this. I replaced that line of code with yours and added "RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)" above.

I get this when I compile

PHP Code:
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\skinmenu3.sma(6) : error 021: symbol already defined: "RegisterHam"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\skinmenu3.sma(73) : error 017: undefined symbol "Flag"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\skinmenu3.sma(77) : error 017: undefined symbol "CTModel"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\skinmenu3.sma(78) : error 017: undefined symbol "TModel"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\skinmenu3.sma(91) : error 017: undefined symbol "g_tModels"
// 
iclassdon is offline
Send a message via MSN to iclassdon
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-22-2020 , 07:39   Re: VIP skin menu help
Reply With Quote #13

I edited my code and added the connect message.

If the models are not set on spawn, you have another plugin that's resetting them. Just tested it with log messages and the correct skin is applied. Try moving the plugin down in plugins.ini to avoid other plugins overwriting the skin.

@Supremache - I don't see how that code is usable with this plugin.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
jonny1990
Senior Member
Join Date: Apr 2020
Old 04-22-2020 , 08:57   Re: VIP skin menu help
Reply With Quote #14

Quote:
Originally Posted by Supremache View Post
I fixed it + I added color chat and i tested it
Pic : https://i.ibb.co/2YmD6Jz/1.png

PHP Code:
#include < amxmodx >  
#include < cstrike >  
#include < hamsandwich >
#include < colorchat >

// PREFIX
new const PREFIX[] = { "VIP Model" };
 
#define PLUGIN "Vip Skins Menu"  
#define VERSION "2.0"  
#define AUTHOR "MrAbdoO"  
 
new bool:g_selected[33];
new 
g_modelt[33][256]
new 
g_modelct[33][256]
 
public 
plugin_precache()  
{  
    
precache_model("models/player/Special_CT/Special_CT.mdl");  
    
precache_model("models/player/Special_CT2/Special_CT2.mdl");  
    
precache_model("models/player/Special_T/Special_T.mdl");  
    
precache_model("models/player/Special_T2/Special_T2.mdl");  
}  
 
public 
plugin_init() {  
    
register_plugin(PLUGINVERSIONAUTHOR)  
 
    
register_clcmd"say /vipskin",  "Skins_Menu" );  
 
    
RegisterHam(Ham_Spawn"player""FwdHamPlayerSpawn"1)

 
public 
FwdHamPlayerSpawn(id) { 
    if(
g_selected[id])
    {
         if(
cs_get_user_team(id) == CS_TEAM_T)
         {
                
cs_set_user_model(idg_modelt[id])
         }
         else
         {
                
cs_set_user_model(idg_modelct[id])
         }
    }

 
public 
Skins_Menu(id) {   
    new 
menu menu_create("Select Your Skin""skin_menu"
    if(
cs_get_user_team(id) & CS_TEAM_CT) { 
        
menu_additemmenu"Special_CT""1"ADMIN_LEVEL_H );   
        
menu_additemmenu"Special_CT2""2"ADMIN_LEVEL_H ); 
    } 
    else if(
cs_get_user_team(id) & CS_TEAM_T) { 
        
menu_additemmenu"Special_T""3"ADMIN_LEVEL_H );   
        
menu_additemmenu"Special_T2""4"ADMIN_LEVEL_H ); 
    } 
 
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );    
    
menu_displayidmenu);   
}   
public 
skin_menu(idmenuitem) {  
    if (
item == MENU_EXIT) {  
        
menu_destroy(menu)  
        return 
PLUGIN_HANDLED;  
    }  
 
    new 
data[6], szName[64]; 
    new 
accesscallback
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback); 
    new 
key str_to_num(data); 
 
    if(!
is_user_alive(id)) 
        return 
PLUGIN_HANDLED 
 
    
switch(key) { 
        case 
1: {  
            
cs_set_user_model(id"Special_CT"); 
            
g_modelct[id] = "Special_CT"
        
        
ColorChat(0GREEN"^4[%s]^1 Your new ^4Special_CT^1 skin has been applied!"PREFIX);    
        } 
        case 
2: {  
            
cs_set_user_model(id"Special_CT2"); 
            
g_modelct[id] = "Special_CT2"
        
        
ColorChat(0GREEN"^4[%s]^1 Your new ^4Special_CT2^1 skin has been applied!"PREFIX);    
        }  
        case 
3: {  
            
cs_set_user_model(id"Special_T");  
            
g_modelt[id] = "Special_T"
        
        
ColorChat(0GREEN"^4[%s]^1 Your new ^4Special_T^1 skin has been applied!"PREFIX);    
        }  
        case 
4: {  
            
cs_set_user_model(id"Special_T2"); 
            
g_modelt[id] = "Special_T2"
        
        
ColorChat(0GREEN"^4[%s]^1 Your new ^4Special_T2^1 skin has been applied!"PREFIX);    
        } 
    }  
    
g_selected[id] = true;
    return 
PLUGIN_CONTINUE;  

something doesn't work, I write /vipskin and the menu doesn't open, the flag is present at me
jonny1990 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-22-2020 , 09:27   Re: VIP skin menu help
Reply With Quote #15

Use the code I provided.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
jonny1990
Senior Member
Join Date: Apr 2020
Old 04-22-2020 , 09:50   Re: VIP skin menu help
Reply With Quote #16

Quote:
Originally Posted by OciXCrom View Post
Use the code I provided.
it doesn't work either! I write /vipskin and the menu doesn't open
jonny1990 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-22-2020 , 10:06   Re: VIP skin menu help
Reply With Quote #17

Meaning you don't have the flag or some plugin is blocking the command.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
jonny1990
Senior Member
Join Date: Apr 2020
Old 04-22-2020 , 10:20   Re: VIP skin menu help
Reply With Quote #18

Quote:
Originally Posted by OciXCrom View Post
Meaning you don't have the flag or some plugin is blocking the command.
all plugins are standard! the flag is registered, checked via amx_who
jonny1990 is offline
jonny1990
Senior Member
Join Date: Apr 2020
Old 04-22-2020 , 10:40   Re: VIP skin menu help
Reply With Quote #19

and Yes it turned out! only how do I make sure that the model is saved when the map changes? and even when you go for another team, for example I CT and go for TE then run to the CT model
jonny1990 is offline
iclassdon
AlliedModders Donor
Join Date: May 2006
Old 04-22-2020 , 14:34   Re: VIP skin menu help
Reply With Quote #20

Quote:
Originally Posted by OciXCrom View Post
I edited my code and added the connect message.

If the models are not set on spawn, you have another plugin that's resetting them. Just tested it with log messages and the correct skin is applied. Try moving the plugin down in plugins.ini to avoid other plugins overwriting the skin.

@Supremache - I don't see how that code is usable with this plugin.
Thank you for the addition! I have moved the plugin down as recommended and its working great.

Quote:
Originally Posted by jonny1990 View Post
and Yes it turned out! only how do I make sure that the model is saved when the map changes? and even when you go for another team, for example I CT and go for TE then run to the CT model
I agree with jonny1990 saving the selection data would be and awesome addition to this plugin. Also if done can we please also add a No Skin option in the menu? So players have option of switching off the custom skins.
iclassdon is offline
Send a message via MSN to iclassdon
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 11:15.


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