Raised This Month: $ Target: $400
 0% 

Models Menu enum


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yagami
Senior Member
Join Date: Jan 2021
Old 08-31-2022 , 12:00   Models Menu enum
Reply With Quote #1

Once again I am here to try to solve my problem
what I'm trying to do is pull the models by "Name", "Time", "Gender".

Exemple:
CT
Male Models - Male Menu
Female Models - Female Menu

TR
Male Models - Male Menu
Female Models - Male Menu

So when the player type /MODELS it will appear menu there will be two options
Male and Female then from there you choose which type of skin you want remembering to "szTeam

I tried to do this yesterday and I was almost 3 hours and could not please someone help me

I tried to use switch(item)
case 1, 2 and I couldn't and now I'm trying to use switch(iTeam)


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

#if !defined MAX_PLAYERS
const MAX_PLAYERS 32
#endif

new g_iUserGender[MAX_PLAYERS 1];

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

}

enum {
    
Male 1,
    
Female 2


new const 
g_eModels[][ModelInfo] =
{
    
    { 
"Special_CT",  CS_TEAM_CTMale"models/player/Special_CT/Special_CT.mdl" },
    { 
"Special_CT2"CS_TEAM_CTMale"models/player/Special_CT2/Special_CT2.mdl" },

    
// CT Female
    
"Perfect"CS_TEAM_CTFemale"models/player/Perfect/Perfect.mdl" },
    { 
"Pirate"CS_TEAM_CTFemale"models/player/pirate/pirate.mdl" },


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

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

const 
INVALID_SKIN = -1
const MENU_ACCESS_FLAG ADMIN_LEVEL_H
const Float:CONNECT_MSG_DELAY 5.0

new g_iModel[MAX_PLAYERS 1][CsTeams]

public 
plugin_init()
{
    
register_plugin("Models Menu""1.0""OciXCrom")
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawn"1)

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

    
CC_SetPrefix("&x04[Prefix]")
}

public 
plugin_precache()
{
    for(new 
isizeof(g_eModels); i++)
    {
        
precache_player_model(g_eModels[i][szModelName])
    }
}

public 
client_putinserver(id)
{
    for(new 
CsTeams:iTeam CS_TEAM_UNASSIGNEDiTeam <= CS_TEAM_SPECTATORiTeam++)
    {
        
g_iModel[id][iTeam] = INVALID_SKIN
    
}

    
set_task(CONNECT_MSG_DELAY"DisplayMessage"id)
}

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

public 
OnPlayerSpawn(id)
{
    if(!
is_user_alive(id))
    {
        return
    }

    new 
iModel g_iModel[id][cs_get_user_team(id)]

    if(
iModel == INVALID_SKIN)
    {
        return
    }

    
cs_set_user_model(idg_eModels[iModel][szModelName])
}

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

    static 
iTeam
    iTeam 
get_user_team(id);

    new 
szMenu[62]

    
formatex(szMenucharsmax(szMenu), "Selecione Sua skin111")

    new 
iMenu menu_create(szMenu"VipSkin_Handler")

    switch(
iTeam)
    {
        case 
CS_TEAM_T:
        {


        }

        case 
CS_TEAM_CT
        {
         
        }
    }
   

    
menu_setprop(iMenuMPROP_EXITNAME"Sair")
    
menu_display(idiMenu)

    return 
PLUGIN_HANDLED 
}

public 
VipSkin_Handler(idiMenuitem)
{
    static 
iTeam
    iTeam 
get_user_team(id)


    switch(
iTeam)
    {
       case 
CS_TEAM_T:
       {

       }
       case 
CS_TEAM_CT:
       {

       }
    }
}

bool:has_menu_access(id)
{
    return (
get_user_flags(id) & MENU_ACCESS_FLAG) != 0
}

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)


Last edited by yagami; 08-31-2022 at 12:02. Reason: one thing was missing
yagami is offline
 



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:35.


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