Raised This Month: $ Target: $400
 0% 

Need help with model menu!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ic3z
Junior Member
Join Date: Jun 2009
Old 08-30-2009 , 17:07   Need help with model menu!
Reply With Quote #1

Hi I'm making an Admin Model Menu plugin which does the following...
When you type /models a model menu comes up if you have ADMIN_BAN flag
From the menu, you can select a model you want to be and you will switch to that player model once you select it, all of my models have a ct version (blue) and a t version (red) and some have a spectate version also. When you are ct and you go into the model menu and select a model, it will load the ct version and vice versa.

But there is a problem, when you switch team you keep the model you had. For example in ct you type /models and select the Teletubby model, you are now a blue teletubby but when you switch to terrorist, you stay as a blue teletubby instead of automatically changing to a red one which corresponds with your team. I tried fixing this problem but at the moment, as soon as i spawn again my model is reset to teletubby (with whatever colour corresponds to my team). But I need it to change to the model I have selected from the model menu, just change model depending on which team I am on.

I hope I explained my situation clearly enough :S Sorry if I didn't, if so ask any other questions you may need to know. Here is the full code for my plugin

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

#define VERSION    "0.1"

#pragma semicolon 1

//new g_teleCt;
//new g_teleT;
//new g_benderBT;
//new g_benderBCt;
//new g_benderFT;
//new g_benderFCt;
//new g_benderFSpec;
//new g_haloT;
//new g_haloCt;
//new g_haloSpec;
//new g_skelT;
//new g_skelCt;
//new g_skelSpec;
//new g_agentSmT;
//new g_agentSmCt;
//new g_agentSmSpec;

public plugin_init( )
{
    
register_plugin"Admin Models"VERSION"icez" );
    
    
register_clcmd"say /models""chooseModel"ADMIN_BAN );

        
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawn"1);
}

public 
plugin_precache( )
{
    
//g_teleCt = precache_model("models/player/admin/teletubby_ct.mdl");
    //g_teleT = precache_model ("models/player/admin/teletubby_t.mdl");
    //g_benderBT = precache_model("models/player/admin/bender_t.mdl");
    //g_benderBCt = precache_model("models/player/admin/bender_ct.mdl");
    //g_benderFT = precache_model("models/player/admin/bender_futurama_t.mdl");
    //g_benderFCt = precache_model("models/player/admin/bender_futurama_ct.mdl");
    //g_benderFSpec = precache_model("models/player/admin/bender_futurama_spec.mdl");
    //g_haloT = precache_model("models/player/admin/halo_t.mdl");
    //g_haloCt = precache_model("models/player/admin/halo_ct.mdl");
    //g_haloSpec = precache_model("models/player/admin/halo_spec.mdl");
    //g_skelT = precache_model("models/player/admin/skeleton_t.mdl");
    //g_skelCt = precache_model("models/player/admin/skeleton_ct.mdl");
    //g_skelSpec = precache_model("models/player/admin/skeleton_spec.mdl");
    //g_agentSmT = precache_model("models/player/admin/agentsmith_t.mdl");
    //g_agentSmCt = precache_model("models/player/admin/agentsmith_ct.mdl");
    //g_agentSmSpec = precache_model("models/player/admin/agentsmith_spec.mdl");
    //precache_model( "models/player/teletubby_t/teletubby_t.mdl" );
    
precache_model"models/player/teletubby_t/teletubby_tT.mdl" );
    
precache_model"models/player/teletubby_ct/teletubby_ct.mdl" );
    
precache_model"models/player/teletubby_ct/teletubby_ctT.mdl" );
    
precache_model"models/player/bendert/bendert.mdl" );
    
precache_model"models/player/benderct/benderct.mdl" );
    
precache_model"models/player/bender_futurama_t/bender_futurama_t.mdl" );
    
precache_model"models/player/bender_futurama_ct/bender_futurama_ct.mdl" );
    
precache_model"models/player/bender_futurama_spec/bender_futurama_spec.mdl" );
    
precache_model"models/player/halo_t/halo_t.mdl" );
    
precache_model"models/player/halo_ct/halo_ct.mdl" );
    
precache_model"models/player/halo_spec/halo_spec.mdl" );
    
precache_model"models/player/skeleton_t/skeleton_t.mdl" );
    
precache_model"models/player/skeleton_ct/skeleton_ct.mdl" );
    
precache_model"models/player/skeleton_spec/skeleton_spec.mdl" );
    
precache_model"models/player/agentsmith_t/agentsmith_t.mdl" );
    
precache_model"models/player/agentsmith_ct/agentsmith_ct.mdl" );
    
precache_model"models/player/agentsmith_spec/agentsmith_spec.mdl" );
}

public 
fwHamPlayerSpawniClient )
{
    if ( !( 
get_user_flagsiClient ) & ADMIN_BAN ) )
        return 
PLUGIN_HANDLED;
    
    else if (
is_user_aliveiClient ))
    {
        new 
szModel32 ];
        
cs_get_user_modeliClientszModel31 );
        
        if ( 
containszModel"teletubby" ) )
        {
            switch ( 
cs_get_user_teamiClient ) )
            {
                case 
CS_TEAM_Tcs_set_user_modeliClient"teletubby_t" );
                case 
CS_TEAM_CTcs_set_user_modeliClient"teletubby_ct" );
            }
        }
        else if ( 
containszModel"bender_futurama" ) )
        {
            switch ( 
cs_get_user_teamiClient ) )
            {
                case 
CS_TEAM_Tcs_set_user_modeliClient"bender_futurama_t" );
                case 
CS_TEAM_CTcs_set_user_modeliClient"bender_futurama_ct" );
                case 
CS_TEAM_SPECTATORcs_set_user_modeliClient"bender_futurama_spec" );
            }
        }
        else if ( 
containszModel"bender" ) )
        {
            switch ( 
cs_get_user_teamiClient ) )
            {
                case 
CS_TEAM_Tcs_set_user_modeliClient"bender_t" );
                case 
CS_TEAM_CTcs_set_user_modeliClient"bender_ct" );
            }
        }
        else if ( 
containszModel"skeleton" ) )
        {
            switch ( 
cs_get_user_teamiClient ) )
            {
                case 
CS_TEAM_Tcs_set_user_modeliClient"skeleton_t" );
                case 
CS_TEAM_CTcs_set_user_modeliClient"skeleton_ct" );
                case 
CS_TEAM_SPECTATORcs_set_user_modeliClient"skeleton_spec" );
            }
        }
        else if ( 
containszModel"agentsmith" ) )
        {
            switch ( 
cs_get_user_teamiClient ) )
            {
                case 
CS_TEAM_Tcs_set_user_modeliClient"agentsmith_t" );
                case 
CS_TEAM_CTcs_set_user_modeliClient"agentsmith_ct" );
                case 
CS_TEAM_SPECTATORcs_set_user_modeliClient"agentsmith_spec" );
            }
        }
        else if ( 
containszModel"halo" ) )
        {
            switch ( 
cs_get_user_teamiClient ) )
            {
                case 
CS_TEAM_Tcs_set_user_modeliClient"halo_t" );
                case 
CS_TEAM_CTcs_set_user_modeliClient"halo_ct" );
                case 
CS_TEAM_SPECTATORcs_set_user_modeliClient"halo_spec" );
            }
        }
    }
}

public 
chooseModelid )
{
    if ( !( 
get_user_flagsid ) & ADMIN_BAN ) )
        return 
PLUGIN_HANDLED;
    
    new 
menu menu_create"\rModel Menu""menu_handler" );
    
    
menu_additemmenu"Teletubby""1");
    
menu_additemmenu"Bender (Futurama)""2");
    
menu_additemmenu"Bender""3");
    
menu_additemmenu"Skeleton""4");
    
menu_additemmenu"Agent Smith""5");
    
menu_additemmenu"Halo""6");
    
    
menu_displayidmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
menu_handleridmenuitem )
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
data], iName64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata,5iName63callback );
    
    switch ( 
str_to_numdata ) )
    {
        case 
1:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"teletubby_t" );
                    }
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"teletubby_ct" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
2:
{
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_t" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_ct" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_spec" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
3:
{
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_t" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_ct" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
4:
{
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_t" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_ct" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_spec" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
5:
{
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_t" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_ct" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_spec" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
6:
{
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_t" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_ct" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_spec" );

                        
//set_user_rendering( id, kRenderFxGlowShell, random(255), random(255), random(255), kRenderNormal, 20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
    }
    
    return 
PLUGIN_HANDLED;


Last edited by ic3z; 08-30-2009 at 21:08.
ic3z is offline
Old 08-30-2009, 21:26
ic3z
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Old 08-31-2009, 06:52
vato loco [GE-S]
This message has been deleted by vato loco [GE-S].
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-31-2009 , 07:28   Re: Need help with model menu!
Reply With Quote #4

try this
not tested i have not the models !!!
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#define VERSION    "0.1"

#define RANDOM_NUM  random_num(0,255)

new const g_ModelPath[][] = {
    
"models/player/teletubby_t/teletubby_t.mdl",
    
"models/player/teletubby_ct/teletubby_ct.mdl",
    
"models/player/bendert_t/bendert_t.mdl",
    
"models/player/bender_ct/bender_ct.mdl",
    
"models/player/bender_futurama_t/bender_futurama_t.mdl",
    
"models/player/bender_futurama_ct/bender_futurama_ct.mdl",
    
"models/player/halo_t/halo_t.mdl",
    
"models/player/halo_ct/halo_ct.mdl",
    
"models/player/skeleton_t/skeleton_t.mdl",
    
"models/player/skeleton_ct/skeleton_ct.mdl",
    
"models/player/agentsmith_t/agentsmith_t.mdl",
    
"models/player/agentsmith_ct/agentsmith_ct.mdl"
};

new 
g_PlayerModel[33]
new 
g_iPlayerAdmin[33]

public 
plugin_init( )
{
    
register_plugin"Admin Models"VERSION"icez" );
    
    
register_clcmd"say /models""chooseModel"ADMIN_BAN );
    
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawn"1);
}

public 
plugin_precache( )
{
    for( new 
sizeofg_ModelPath ) ; i++ )
    {
        
precache_modelg_ModelPath[i] );
    }
}

public 
client_putinserver(iClient)
{
    if ( 
get_user_flagsiClient ) & ADMIN_BAN )
    {
        
g_iPlayerAdmin[iClient] = true
        g_PlayerModel
[iClient] = 0
    
}
}

public 
client_disconnect(iClient)
{
    if( 
g_iPlayerAdmin[iClient])
    {
        
g_iPlayerAdmin[iClient] = false
        g_PlayerModel
[iClient] = 0
    
}
}

public 
fwHamPlayerSpawniClient )
{
    if (
is_user_aliveiClient ) && g_iPlayerAdminiClient ])
    {
        new 
g_PlayerModelID g_PlayerModel[iClient]
        switch ( 
cs_get_user_teamiClient ) )
        {
            case 
CS_TEAM_T
            {
                switch(
g_PlayerModelID)
                {
                    case 
11cs_set_user_modeliClient"teletubby_t" );
                        
                    case 
12
                    {
                        
cs_set_user_modeliClient"teletubby_t" );
                        
g_PlayerModel[iClient] = 11
                    
}
                    
                    case 
21cs_set_user_modeliClient"bender_futurama_t" );
                        
                    case 
22
                    { 
                        
cs_set_user_modeliClient"bender_futurama_t" );
                        
g_PlayerModel[iClient] = 21
                    
}
                    
                    case 
31cs_set_user_modeliClient"bender_t" );
                        
                    case 
32
                    {
                        
cs_set_user_modeliClient"bender_t" );
                        
g_PlayerModel[iClient] = 31
                    
}
                    
                    case 
41cs_set_user_modeliClient"skeleton_t" );
                        
                    case 
42
                    {
                        
cs_set_user_modeliClient"skeleton_t" );
                        
g_PlayerModel[iClient] = 41
                    
}
                    
                    case 
51cs_set_user_modeliClient"agentsmith_t" );
                        
                    case 
52
                    {
                        
cs_set_user_modeliClient"agentsmith_t" );
                        
g_PlayerModel[iClient] = 51
                    
}
                    
                    case 
61cs_set_user_modeliClient"halo_t" );
                        
                    case 
62
                    {
                        
cs_set_user_modeliClient"halo_t" );
                        
g_PlayerModel[iClient] = 61
                    
}
                    
                }
            }
            case 
CS_TEAM_CT:
            { 
                switch(
g_PlayerModelID)
                {
                    case 
11
                    {
                        
cs_set_user_modeliClient"teletubby_ct" );
                        
g_PlayerModel[iClient] = 12
                    
}
                    
                    case 
12cs_set_user_modeliClient"teletubby_ct" );
                        
                    case 
21
                    {
                        
cs_set_user_modeliClient"bender_futurama_ct" );
                        
g_PlayerModel[iClient] = 22
                    
}
                    
                    case 
22cs_set_user_modeliClient"bender_futurama_ct" );
                        
                    case 
31
                    {
                        
cs_set_user_modeliClient"bender_ct" );
                        
g_PlayerModel[iClient] = 32
                    
}
                    
                    case 
32cs_set_user_modeliClient"bender_ct" );
                        
                    case 
41
                    {
                        
cs_set_user_modeliClient"skeleton_ct" );
                        
g_PlayerModel[iClient] = 42
                    
}
                    
                    case 
42cs_set_user_modeliClient"skeleton_ct" );
                        
                    case 
51
                    {
                        
cs_set_user_modeliClient"agentsmith_ct" );
                        
g_PlayerModel[iClient] = 52
                    
}
                    
                    case 
52cs_set_user_modeliClient"agentsmith_ct" );
                        
                    case 
61
                    {
                        
cs_set_user_modeliClient"halo_ct" );
                        
g_PlayerModel[iClient] = 62
                    
}
                    
                    case 
62cs_set_user_modeliClient"halo_ct" );
                        
                }
            }
        }
    }
}

public 
chooseModelid )
{
    if ( !
g_iPlayerAdmin[id] )
        return 
PLUGIN_HANDLED;
    
    new 
menu menu_create"\rModel Menu""menu_handler" );
    
    
menu_additemmenu"Teletubby""1");
    
menu_additemmenu"Bender (Futurama)""2");
    
menu_additemmenu"Bender""3");
    
menu_additemmenu"Skeleton""4");
    
menu_additemmenu"Agent Smith""5");
    
menu_additemmenu"Halo""6");
    
    
menu_displayidmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
menu_handleridmenuitem )
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
data], iName64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata,5iName63callback );
    
    switch ( 
str_to_numdata ) )
    {
        case 
1:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"teletubby_t" );
                        
g_PlayerModel[id] = 11
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUM RANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE                 
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"teletubby_ct" );
                        
g_PlayerModel[id] = 12
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUM RANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
2:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_t" );
                        
g_PlayerModel[id] = 21
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_ct" );
                        
g_PlayerModel[id] = 22
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
3:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_t" );
                        
g_PlayerModel[id] = 31
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_ct" );
                        
g_PlayerModel[id] = 32
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
4:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_t" );
                        
g_PlayerModel[id] = 41
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_ct" );
                        
g_PlayerModel[id] = 42
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
5:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_t" );
                        
g_PlayerModel[id] = 51
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_ct" );
                        
g_PlayerModel[id] = 52
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
6:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_t" );
                        
g_PlayerModel[id] = 61
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_ct" );
                        
g_PlayerModel[id] = 62
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
    }
    return 
PLUGIN_HANDLED;

__________________

Last edited by vato loco [GE-S]; 08-31-2009 at 08:29.
vato loco [GE-S] is offline
ic3z
Junior Member
Join Date: Jun 2009
Old 08-31-2009 , 09:28   Re: Need help with model menu!
Reply With Quote #5

Thanks a lot loco, i'll try them now, and if you want the models you can have them There is a bender model in there (your avatar pic)
Edit: It works!

I have one more question though, there are also some models with specate? How can I set cases for specate, shall I just make a new case e.g. case 33? Or do I have to do something else!?

Edit: Changed plugin so it works for spectate models now also.

Last edited by ic3z; 08-31-2009 at 12:48.
ic3z is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-31-2009 , 11:34   Re: Need help with model menu!
Reply With Quote #6

as far as i know you can't set for spectator models
player in spec is not alive
maybe i'am wrong !!!
but if i'm right
the forward playerspawn
will have no effect on spectator
because your are cheking if player is alive
in the forward.
by the way for what do you need spectator model???
i think it's less

to do the code is easy !!!
__________________

Last edited by vato loco [GE-S]; 08-31-2009 at 11:39.
vato loco [GE-S] is offline
ic3z
Junior Member
Join Date: Jun 2009
Old 08-31-2009 , 12:41   Re: Need help with model menu!
Reply With Quote #7

Vato, I have amx super plugin, when you type /spec you join specate without dying (I think you don't die because I also have Hide N Seek plugin which blocks kill command). But even if I didn't have HnS Plugin, I could join spectate and use amx_revive and then I would be alive in spectate, advantages of being specate are that on new round you're player is not restarted so you stay in the same spot, useful for Hide N Seek anyway.

Admins on my server go to spectate all the time if they want to funjump, build blocks etc. So That's why I wanted to do it for Spectators Also!

Anyway, I edited the plugin and now it works on forward playerspawn with spectate also!

I also have one problem, because when I type /spec I don't die but go straight to spec, I have to revive myself again for the model to change to spectator model, is there a way to detect if I am spectator without me spawning again?

If anyone knows if you can detect it that way then please tell me the code.

Last edited by ic3z; 08-31-2009 at 12:45.
ic3z is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-31-2009 , 12:52   Re: Need help with model menu!
Reply With Quote #8

sorry don't know enything about hns never played it !!!
but in my kz plugin you can also type /spec
and you go to spectator but the player flag is set dead
PHP Code:
set_pev(idpev_deadflagDEAD_DEAD
player is not alive.
if you want i edit the code that i post and put the spec stuff in
like in your original code...but no garanty that it will work hehehe

when your are sure that you alive as spectator here try it
i have add the spec stuff in this code
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#define VERSION    "0.1"

#define RANDOM_NUM  random_num(0,255)

new const g_ModelPath[][] = {
    
"models/player/teletubby_t/teletubby_t.mdl",
    
"models/player/teletubby_ct/teletubby_ct.mdl",
    
"models/player/bendert_t/bendert_t.mdl",
    
"models/player/bender_ct/bender_ct.mdl",
    
"models/player/bender_futurama_t/bender_futurama_t.mdl",
    
"models/player/bender_futurama_ct/bender_futurama_ct.mdl",
    
"models/player/halo_t/halo_t.mdl",
    
"models/player/halo_ct/halo_ct.mdl",
    
"models/player/skeleton_t/skeleton_t.mdl",
    
"models/player/skeleton_ct/skeleton_ct.mdl",
    
"models/player/agentsmith_t/agentsmith_t.mdl",
    
"models/player/agentsmith_ct/agentsmith_ct.mdl",
    
"models/player/bender_futurama_spec/bender_futurama_spec.mdl",
    
"models/player/halo_spec/halo_spec.mdl",
    
"models/player/skeleton_spec/skeleton_spec.mdl",
    
"models/player/agentsmith_spec/agentsmith_spec.mdl"
};

new 
g_PlayerModel[33]
new 
g_iPlayerAdmin[33]

public 
plugin_init( )
{
    
register_plugin"Admin Models"VERSION"icez" );
    
    
register_clcmd"say /models""chooseModel"ADMIN_BAN );
    
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawn"1);
}

public 
plugin_precache( )
{
    for( new 
sizeofg_ModelPath ) ; i++ )
    {
        
precache_modelg_ModelPath[i] );
    }
}

public 
client_putinserver(iClient)
{
    if ( 
get_user_flagsiClient ) & ADMIN_BAN )
    {
        
g_iPlayerAdmin[iClient] = true
        g_PlayerModel
[iClient] = 0
    
}
}

public 
client_disconnect(iClient)
{
    if( 
g_iPlayerAdmin[iClient])
    {
        
g_iPlayerAdmin[iClient] = false
        g_PlayerModel
[iClient] = 0
    
}
}

public 
fwHamPlayerSpawniClient )
{
    if (
is_user_aliveiClient ) && g_iPlayerAdminiClient ])
    {
        new 
g_PlayerModelID g_PlayerModel[iClient]
        switch ( 
cs_get_user_teamiClient ) )
        {
            case 
CS_TEAM_T
            {
                switch(
g_PlayerModelID)
                {
                    case 
11cs_set_user_modeliClient"teletubby_t" );
                        
                    case 
12
                    {
                        
cs_set_user_modeliClient"teletubby_t" );
                        
g_PlayerModel[iClient] = 11
                    
}
                    
                    case 
21cs_set_user_modeliClient"bender_futurama_t" );
                        
                    case 
22
                    { 
                        
cs_set_user_modeliClient"bender_futurama_t" );
                        
g_PlayerModel[iClient] = 21
                    
}
                    
                    case 
23:
                    {
                        
cs_set_user_modeliClient"bender_futurama_t" );
                        
g_PlayerModel[iClient] = 21
                    
}
                    
                    case 
31cs_set_user_modeliClient"bender_t" );
                        
                    case 
32
                    {
                        
cs_set_user_modeliClient"bender_t" );
                        
g_PlayerModel[iClient] = 31
                    
}
                    
                    case 
41cs_set_user_modeliClient"skeleton_t" );
                        
                    case 
42
                    {
                        
cs_set_user_modeliClient"skeleton_t" );
                        
g_PlayerModel[iClient] = 41
                    
}
                    
                    case 
43:
                    {
                        
cs_set_user_modeliClient"skeleton_t" );
                        
g_PlayerModel[iClient] = 41
                    
}
                    
                    case 
51cs_set_user_modeliClient"agentsmith_t" );
                        
                    case 
52
                    {
                        
cs_set_user_modeliClient"agentsmith_t" );
                        
g_PlayerModel[iClient] = 51
                    
}
                    
                    case 
53:
                    {
                        
cs_set_user_modeliClient"agentsmith_t" );
                        
g_PlayerModel[iClient] = 51
                    
}
                    
                    case 
61cs_set_user_modeliClient"halo_t" );
                        
                    case 
62
                    {
                        
cs_set_user_modeliClient"halo_t" );
                        
g_PlayerModel[iClient] = 61
                    
}
                    
                    case 
63:
                    {
                        
cs_set_user_modeliClient"halo_t" );
                        
g_PlayerModel[iClient] = 61
                    
}
                    
                }
            }
            case 
CS_TEAM_CT:
            { 
                switch(
g_PlayerModelID)
                {
                    case 
11
                    {
                        
cs_set_user_modeliClient"teletubby_ct" );
                        
g_PlayerModel[iClient] = 12
                    
}
                    
                    case 
12cs_set_user_modeliClient"teletubby_ct" );
                        
                    case 
21
                    {
                        
cs_set_user_modeliClient"bender_futurama_ct" );
                        
g_PlayerModel[iClient] = 22
                    
}
                    
                    case 
22cs_set_user_modeliClient"bender_futurama_ct" );
                        
                    case 
23:
                    {
                        
cs_set_user_modeliClient"bender_futurama_ct" );
                        
g_PlayerModel[iClient] = 22
                    
}
                    
                    case 
31
                    {
                        
cs_set_user_modeliClient"bender_ct" );
                        
g_PlayerModel[iClient] = 32
                    
}
                    
                    case 
32cs_set_user_modeliClient"bender_ct" );
                        
                    case 
41
                    {
                        
cs_set_user_modeliClient"skeleton_ct" );
                        
g_PlayerModel[iClient] = 42
                    
}
                    
                    case 
42cs_set_user_modeliClient"skeleton_ct" );
                        
                    case 
43:
                    {
                        
cs_set_user_modeliClient"skeleton_ct" );
                        
g_PlayerModel[iClient] = 42
                    
}
                    
                    case 
51
                    {
                        
cs_set_user_modeliClient"agentsmith_ct" );
                        
g_PlayerModel[iClient] = 52
                    
}
                    
                    case 
52cs_set_user_modeliClient"agentsmith_ct" );
                        
                    case 
53:
                    {
                        
cs_set_user_modeliClient"agentsmith_ct" );                        cs_set_user_modeliClient"agentsmith_ct" );
                        
g_PlayerModel[iClient] = 52
                    
}
                    
                    case 
61
                    {
                        
cs_set_user_modeliClient"halo_ct" );
                        
g_PlayerModel[iClient] = 62
                    
}
                    
                    case 
62cs_set_user_modeliClient"halo_ct" );
                        
                    case 
63
                    {
                        
cs_set_user_modeliClient"halo_ct" );
                        
g_PlayerModel[iClient] = 62
                    
}
                    
                }
            }
            case 
CS_TEAM_SPECTATOR:
            {
                switch(
g_PlayerModelID)
                {
                    case 
23cs_set_user_modeliClient"bender_futurama_spec" );    
                        
                    case 
43cs_set_user_modeliClient"skeleton_spec" );
                        
                    case 
53cs_set_user_modeliClient"agentsmith_spec" );
                        
                    case 
63cs_set_user_modeliClient"halo_spec" );
                        
                }
            }
        }
    }
}

public 
chooseModelid )
{
    if ( !
g_iPlayerAdmin[id] )
        return 
PLUGIN_HANDLED;
    
    new 
menu menu_create"\rModel Menu""menu_handler" );
    
    
menu_additemmenu"Teletubby""1");
    
menu_additemmenu"Bender (Futurama)""2");
    
menu_additemmenu"Bender""3");
    
menu_additemmenu"Skeleton""4");
    
menu_additemmenu"Agent Smith""5");
    
menu_additemmenu"Halo""6");
    
    
menu_displayidmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
menu_handleridmenuitem )
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
data], iName64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata,5iName63callback );
    
    switch ( 
str_to_numdata ) )
    {
        case 
1:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"teletubby_t" );
                        
g_PlayerModel[id] = 11
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUM RANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE                 
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"teletubby_ct" );
                        
g_PlayerModel[id] = 12
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUM RANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
2:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_t" );
                        
g_PlayerModel[id] = 21
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_ct" );
                        
g_PlayerModel[id] = 22
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_futurama_spec" );
                        
g_PlayerModel[id] = 23
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
3:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_t" );
                        
g_PlayerModel[id] = 31
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"bender_ct" );
                        
g_PlayerModel[id] = 32
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
4:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_t" );
                        
g_PlayerModel[id] = 41
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_ct" );
                        
g_PlayerModel[id] = 42
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"skeleton_spec" );
                        
g_PlayerModel[id] = 43
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
5:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_t" );
                        
g_PlayerModel[id] = 51
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_ct" );
                        
g_PlayerModel[id] = 52
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"agentsmith_spec" );
                        
g_PlayerModel[id] = 53
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 );  // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
        case 
6:
        {
            switch ( 
cs_get_user_teamid ) )
            {
                case 
CS_TEAM_T:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_t" );
                        
g_PlayerModel[id] = 61
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 255, 0, 0 = RED
                    
}
                }
                case 
CS_TEAM_CT:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_ct" );
                        
g_PlayerModel[id] = 62
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
                case 
CS_TEAM_SPECTATOR:
                {
                    if ( 
is_user_aliveid ) )
                    {
                        
cs_set_user_modelid"halo_spec" );
                        
g_PlayerModel[id] = 63
                        set_user_rendering
idkRenderFxGlowShellRANDOM_NUMRANDOM_NUMRANDOM_NUMkRenderNormal20 ); // RANDOM GLOW - 0, 0, 255 = BLUE
                    
}
                }
            }
        }
    }
    return 
PLUGIN_HANDLED;

__________________

Last edited by vato loco [GE-S]; 08-31-2009 at 14:24.
vato loco [GE-S] is offline
ic3z
Junior Member
Join Date: Jun 2009
Old 08-31-2009 , 14:06   Re: Need help with model menu!
Reply With Quote #9

Thanks for the code, +karma. I did it a longer and different way, but with you code when you go to spectate it changes to spec, but what about when you go back to T or Ct from spectate? Will it change back to t or ct models?

Last edited by ic3z; 08-31-2009 at 14:19.
ic3z is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-31-2009 , 14:26   Re: Need help with model menu!
Reply With Quote #10

ok try the code one post above
i have edit the code should work now
that when you join ct or t get your normal model back !!!
__________________
vato loco [GE-S] 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 15:00.


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