AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Model Menu (https://forums.alliedmods.net/showthread.php?t=232693)

GFXMihnea 01-03-2014 11:51

Model Menu
 
A friend of mine has made for me an simple plugin, it works when i have the flag "r" and i enter in the server a menu auto appears, and i select a model, but nothing happens...
I want to make it work, and if i can, to disable the "RegisterHam( Ham_Spawn, "player", "bacon_PlayerSpawned", 1 );" and put a chat command like /owner or /model... If the user has not "r" flag, prind in chat "you have no acces"...if select a model 1 print in chat "you have selected model1" etc.
Thank you for help.

Code:

#include < amxmodx >
#include < amxmisc >

#include < cstrike >
#include < hamsandwich >

#pragma semicolon 1

#define PLUGIN_VERSION  "1.0.1"

new const gModel1[ ] = "models/player/model1/model1.mdl";
new const gModel2[ ] = "models/player/model2/model2.mdl";
new const gModel3[ ] = "models/player/model3/model3.mdl";
new const gModel4[ ] = "models/player/model4/model4.mdl";
//new const gModel6[ ] = "models/player/model6/model6.mdl";
//new const gyuri[ ] = "models/player/yuri/yuri.mdl";
//new const gcmdl[ ] = "models/chaosmedia90/chaosmedia90.mdl";
//new const gcioara[ ] = "models/dragon/dragon.mdl";

new g_Menu;

public plugin_init( )
{
  register_plugin( "Owner Models", PLUGIN_VERSION, "mappingro" );
  RegisterHam( Ham_Spawn, "player", "bacon_PlayerSpawned", 1 );

}

public plugin_precache( )
{
  precache_model( gModel1 );
  precache_model( gModel2 );
  precache_model( gModel3 );
  precache_model( gModel4 );
  // precache_model( gModel6 );
  //precache_model( gyuri );
  // precache_model( gchaosmedia90 );
  //precache_model( gdragon );
}

public plugin_cfg( )
{
        g_Menu = menu_create( "\wModels\r:", "Func_Handler" );
       
        menu_additem( g_Menu, "\wModel 1", "1", 0 );
        menu_additem( g_Menu, "\wModel 2", "2", 0 );
        menu_additem( g_Menu, "\wModel 3", "3", 0 );
        menu_additem( g_Menu, "\wModel 4", "4", 0 );
}

public bacon_PlayerSpawned( id )
{
        if( is_user_alive( id ) && get_user_flags( id ) && read_flags( "r" ))
        {
                menu_display( id, g_Menu, 0 );
        }
}

public Func_Handler( id, menu, item )
{
        switch( item )
        {       
                case 0:
                {
                        cs_set_user_model( id, gModel1 );
                }               
               
                case 1:
                {
                        cs_set_user_model( id, gModel2 );
                }               
               
                case 2:
                {
                        cs_set_user_model( id, gModel3 );
                }
               
                case 3:
                {
                        cs_set_user_model( id, gModel4 );
                }
        }
}



All times are GMT -4. The time now is 20:24.

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