Raised This Month: $ Target: $400
 0% 

Admin Models


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yagami
Senior Member
Join Date: Jan 2021
Old 08-26-2022 , 19:33   Admin Models
Reply With Quote #1

Can someone help me with this skin plugin?

I am trying to make it work and put it to when player enters the server is already with skin that he chose or set an automatic




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

enum _:ModelInfo
{
    
szModelName[64],
    
CsTeam:szTeam,
    
iGender,
    
szModelPath[64]
}

enum
{
    
Male 1,
    
Female 2
}

new const 
g_szModel[][ModelInfo] =
{

    
// Male
    
"Terror Jason"CS_TEAM_CTMale"models/player/cs_terror_jason/jason.mdl" },
    { 
"Leon"CS_TEAM_CTMale"models/player/leon/leon.mdl" },
    { 
"Police"CS_TEAM_CTMale"models/player/police/police.mdl" },

    
// CT Female
    
"Perfect"CS_TEAM_CTFemale"models/player/perfectg/perfectg.mdl" },
    { 
"Pirate"CS_TEAM_CTFemale"models/player/pirate/pirate.mdl" },
    { 
"Police"CS_TEAM_CTFemale"models/player/policefemale/policef.mdl" },


    
// TR Male
    
"Trey"CS_TEAM_TMale"models/player/trey/trey.mdl" },
    { 
"Fast"CS_TEAM_TMale"models/player/fast/girl.mdl" },
    { 
"Get"CS_TEAM_TMale"models/player/amida/get.mdl" },

    
// TR Female
    
"Ashley"CS_TEAM_TMale"models/player/ashley/ashley.mdl" },
    { 
"Nyjon"CS_TEAM_TMale"models/player/Nyjon/Nyjon.mdl" },
    { 
"Tampora"CS_TEAM_TMale"models/player/Tampora/Tampora.mdl" }   

}

public 
plugin_init()
{
    
register_plugin("Model Menu""1.0""OciXCrom")

    
register_clcmd("say /adminmodel""Cmd_VipSkin")
    
register_clcmd("say_team /adminmodel""Cmd_VipSkin")

    
CC_SetPrefix("&x04[Prefix]")
}

new 
g_iUserGender[MAX_PLAYERS 1];

public 
plugin_precache()
{
    for(new 
isizeof(g_eModels); i++)
    {
        if(
file_exists(g_eModels[i][szModelPath]))
        {
            
precache_model(g_eModels[i][szModelPath]);
        } else 
log_amx("Error! Model ^"%s^" does not exists!"g_eModels[i][szModelPath]);
    }
}

public 
client_putinserver(id)
{
    
set_task(CONNECT_MSG_DELAY"DisplayMessage"id)
}

public 
DisplayMessage(id)
{
    if(
is_user_connected(id) && has_menu_access(id))
    {
        
CC_SendMessage(id"Type &x03/admin &x01to open the &x04VIP Skin Menu")
    }
}

public (!
has_menu_access(id))
{
    if(!
has_menu_acess(id))
    {
        
CC_SendMessage(id"Only vips can open this menu, sorry!")
    }

    new 
iMenu menu_create("Select Your Skin""xMenuSkin_Handler")

    static 
iCsTeams:iTeamszNum[5], szMenu[62]
    
iTeam cs_get_user_team(id);

    for(
0sizeof g_eModelsi++)
    {
        if(
g_eModels[i][Team] != iTeam)
            continue;


            
formatex(szMenucharsmax(szNum), "%s \y[%s]"g_eModels[i][Name], g_eModels[iGender] != Female "Male" "Female");

            
num_to_str(iszNumcharsmax(szNum));
            
menu_additem(iMenuszMenuszNum);
    }

    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
xMenuSkin_Handler(idiMenuszItem)
{
    if(!
has_menu_acess(id))
    {
        goto @
destroy
    
}

    static 
_unused[1]

    new 
szModelID[5]
    
menu_item_getinfo(iMenuszItem_unused[0], szModelIDcharsmax(szModelID), _unusedcharsmax(_unused,) _unused[0])

    new 
iModel str_to_num(szModelID)
    new 
CsTeams:iTeam get_user_team(id)

    if(
g_eModels[iModel][Team] != iTeam)
    {
        goto @
destroy
    
}

    
g_eModels[id][iTeam] = iModel
    CC_SendMessage
(id"You have selected the skin &x04%s"g_eModels[iModel][Name])

    if(
is_user_connected(id) && is_user_alive(id))
    {
        
cs_get_user_model(idg_eModels[iModel][Name])
    }

    @
destroy
    menu_destroy
(iMenu)
    return 
PLUGIN_HANDLED
}

bool:has_menu_acess(id)
{
    return (
is_user_admin(id))
}

precache_player_model(const szModel[], &id 0)
{
    new 
model[128]
    
formatex(modelcharsmax(model), "models/player/%s/%sT.mdl"szModelszModel)

    if(
file_exists(model))
        
id precache_generic(model)

    static const 
extension[] = "T.mdl"
    
#pragma unused extension

    
copy(model[strlen(model) - charsmax(extension)], charsmax(model), ".mdl")
    return 
precache_model(model

yagami is offline
 


Thread Tools
Display Modes

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 15:42.


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