Raised This Month: $ Target: $400
 0% 

[HELP] Player Model Menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-27-2017 , 17:19   [HELP] Player Model Menu
Reply With Quote #1

Hello everyone. I made a menu plugin and I have problems with setting the model.
Can someone fix it? Replace VAR with the desired variable.

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <tfcx>
#include <engine>
#include <fakemeta>
#include <fun>

new g_thirdperson=0
new conffile_model[200]
new configdir_model[200]
new file_model[128], leng


public plugin_init() 
{
	register_plugin("Advanced Menu", "1,0", "DarthMan");
	register_clcmd("say menu", "ShowMenu", _, "");
	register_clcmd("say_team menu", "ShowMenu", _, "");
	get_configsdir(configdir_model,199)
	format(conffile_model,199,"%s/models.ini",configdir_model)
}

public plugin_precache()
{
    new conffile_mdl[200]
    new configdir_mdl[200]
 
    get_configsdir(configdir_mdl,199)
    format(conffile_mdl,199,"%s/models.ini",configdir_mdl)
    if(!file_exists(conffile_mdl))
    {
        log_amx("amxmodx/configs/models.ini is missing!")
        return 0
    }
 
    new lines = file_size(conffile_mdl,1)
    new name[128], len
    new model_path[128]
    for(new i=0;i<=lines;i++)
    {
        read_file(conffile_mdl,i,name,127,len)
        if(equal(name,"")) continue;
        if(!equal(name,";",1)) {
            // log_amx("precache: %s", file)
            format(model_path, charsmax(model_path), "models/player/%s/%s.mdl",name,name)
            precache_model(model_path);
        }
    }
    return PLUGIN_HANDLED;
}

/* Player Connect */


/* Player Menu */

public ShowMenu(id)
{
	new menu = menu_create("Player Menu", "mh_PMenu");

	menu_additem(menu, "Models", "", 0); // case 0
	if (g_thirdperson==0)
	{ 
	menu_additem(menu, "Thirdperson View", "", 0); // case 1
	}
	else
	{ 
	menu_additem(menu, "Firstperson View", "", 0); // case 1
	}
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_setprop(menu, MPROP_BACKNAME, "Back");
	menu_setprop(menu, MPROP_NEXTNAME, "Next");
	menu_setprop(menu, MPROP_EXITNAME, "Close");

	menu_display(id, menu, 0);

	return PLUGIN_HANDLED;    
}

public mh_PMenu(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_cancel(id);
		return PLUGIN_HANDLED;
	}

	new command[6], name[64], access, callback;

	menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

	switch(item)
	{
		case 0:
		{
		new menu_model = menu_create("Models Menu", "mh_MMenu")
		for (new i; (i < file_size(conffile_model, 1)); i++)
		{
			read_file(conffile_model, i, file_model, 127, leng)
			menu_additem(menu_model, file_model, "", 0);
		}		
		menu_setprop(menu_model, MPROP_EXIT, MEXIT_ALL);
		menu_setprop(menu_model, MPROP_BACKNAME, "Back");
		menu_setprop(menu_model, MPROP_NEXTNAME, "Next");
		menu_setprop(menu_model, MPROP_EXITNAME, "Close");
		menu_destroy(menu);
		menu_display(id, menu_model, 0);
		}
		case 1:
		{
		if (g_thirdperson==0)
		    {
			client_print(id, print_chat, "You have selected Thirdperson View");
			g_thirdperson=1;
			set_view(id, CAMERA_3RDPERSON);
			return PLUGIN_CONTINUE;
		    }
		else
		    {
			client_print(id, print_chat, "You have selected Firstperson View");
			g_thirdperson=0;
			set_view(id, CAMERA_NONE);
			return PLUGIN_CONTINUE;
		    }		
		}
	}

	return PLUGIN_HANDLED;
}

public mh_MMenu(id, menu_model, item)
{
	if(item == MENU_EXIT)
	{
		menu_cancel(id);
		return PLUGIN_HANDLED;
	}

	new command[6], name[64], access, callback;

	menu_item_getinfo(menu_model, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

	switch(item)
	{
		case 0:
		{
		//tfc_setmodel(id,VAR,"0");
		//client_print(id, print_chat, "You changed the player model to %s.", VAR);
		}
	}

	menu_destroy(menu_model);

	return PLUGIN_CONTINUE;
}

Last edited by DarthMan; 02-27-2017 at 17:21.
DarthMan 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 20:43.


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