|
Junior Member
|

08-30-2009
, 17:07
Need help with model menu!
|
#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 fwHamPlayerSpawn( iClient ) { if ( !( get_user_flags( iClient ) & ADMIN_BAN ) ) return PLUGIN_HANDLED; else if (is_user_alive( iClient )) { new szModel[ 32 ]; cs_get_user_model( iClient, szModel, 31 ); if ( contain( szModel, "teletubby" ) ) { switch ( cs_get_user_team( iClient ) ) { case CS_TEAM_T: cs_set_user_model( iClient, "teletubby_t" ); case CS_TEAM_CT: cs_set_user_model( iClient, "teletubby_ct" ); } } else if ( contain( szModel, "bender_futurama" ) ) { switch ( cs_get_user_team( iClient ) ) { case CS_TEAM_T: cs_set_user_model( iClient, "bender_futurama_t" ); case CS_TEAM_CT: cs_set_user_model( iClient, "bender_futurama_ct" ); case CS_TEAM_SPECTATOR: cs_set_user_model( iClient, "bender_futurama_spec" ); } } else if ( contain( szModel, "bender" ) ) { switch ( cs_get_user_team( iClient ) ) { case CS_TEAM_T: cs_set_user_model( iClient, "bender_t" ); case CS_TEAM_CT: cs_set_user_model( iClient, "bender_ct" ); } } else if ( contain( szModel, "skeleton" ) ) { switch ( cs_get_user_team( iClient ) ) { case CS_TEAM_T: cs_set_user_model( iClient, "skeleton_t" ); case CS_TEAM_CT: cs_set_user_model( iClient, "skeleton_ct" ); case CS_TEAM_SPECTATOR: cs_set_user_model( iClient, "skeleton_spec" ); } } else if ( contain( szModel, "agentsmith" ) ) { switch ( cs_get_user_team( iClient ) ) { case CS_TEAM_T: cs_set_user_model( iClient, "agentsmith_t" ); case CS_TEAM_CT: cs_set_user_model( iClient, "agentsmith_ct" ); case CS_TEAM_SPECTATOR: cs_set_user_model( iClient, "agentsmith_spec" ); } } else if ( contain( szModel, "halo" ) ) { switch ( cs_get_user_team( iClient ) ) { case CS_TEAM_T: cs_set_user_model( iClient, "halo_t" ); case CS_TEAM_CT: cs_set_user_model( iClient, "halo_ct" ); case CS_TEAM_SPECTATOR: cs_set_user_model( iClient, "halo_spec" ); } } } }
public chooseModel( id ) { if ( !( get_user_flags( id ) & ADMIN_BAN ) ) return PLUGIN_HANDLED; new menu = menu_create( "\rModel Menu", "menu_handler" ); menu_additem( menu, "Teletubby", "1", 0 ); menu_additem( menu, "Bender (Futurama)", "2", 0 ); menu_additem( menu, "Bender", "3", 0 ); menu_additem( menu, "Skeleton", "4", 0 ); menu_additem( menu, "Agent Smith", "5", 0 ); menu_additem( menu, "Halo", "6", 0 ); menu_display( id, menu, 0 ); return PLUGIN_HANDLED; }
public menu_handler( id, menu, item ) { if ( item == MENU_EXIT ) { menu_destroy( menu ); return PLUGIN_HANDLED; } new data[ 6 ], iName[ 64 ]; new access, callback; menu_item_getinfo( menu, item, access, data,5, iName, 63, callback ); switch ( str_to_num( data ) ) { case 1: { switch ( cs_get_user_team( id ) ) { case CS_TEAM_T: { if ( is_user_alive( id ) ) { cs_set_user_model( id, "teletubby_t" ); } } case CS_TEAM_CT: { if ( is_user_alive( id ) ) { cs_set_user_model( id, "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_team( id ) ) { case CS_TEAM_T: { if ( is_user_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_team( id ) ) { case CS_TEAM_T: { if ( is_user_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_team( id ) ) { case CS_TEAM_T: { if ( is_user_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_team( id ) ) { case CS_TEAM_T: { if ( is_user_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_team( id ) ) { case CS_TEAM_T: { if ( is_user_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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_alive( id ) ) { cs_set_user_model( id, "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.
|
|