Raised This Month: $ Target: $400
 0% 

[HELP] Player Model Menu


Post New Thread Reply   
 
Thread Tools Display Modes
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
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-27-2017 , 17:26   Re: [HELP] Player Model Menu
Reply With Quote #2

What's the problem firstly
__________________
edon1337 is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-28-2017 , 01:13   Re: [HELP] Player Model Menu
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
What's the problem firstly
The problem is, in the way I made the vars, idk how I can set it to change the model.
Look at all the global vars and the local i var, and see what can be done.
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-28-2017 , 05:50   Re: [HELP] Player Model Menu
Reply With Quote #4

Quote:
Originally Posted by edon1337 View Post
What's the problem firstly
When u select an item it should change the model to the specified item and then display the model name as a client_print id message.

Last edited by DarthMan; 02-28-2017 at 09:35.
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-28-2017 , 12:01   Re: [HELP] Player Model Menu
Reply With Quote #5

Let me be more explicit. So what I did was a menu which at the moment can be used to change ur model or view from 1st to 3rd eprson view or vice-versa. There is an issue actually that I can't solve. I've tried some ways and failed. When u select the model tab, it will display all models from the ini file in the menu. However, if u select a model it won't change because I don't know how to do that. So absically what I require is a script on public mh_PMenu(id, menu, item) case 0 that will change the model according to the model name from the selected item. So if for example the 1st tiem from the model menu is abe, the plugin is supossed to change ur model to abe, by using the tfc_setmodel command. I hope that whoever reads the message now will understand what I need. Thanks !
DarthMan is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-28-2017 , 12:50   Re: [HELP] Player Model Menu
Reply With Quote #6

1.Learn how to use the edit button.
2.What game is this for?
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 02-28-2017 , 12:59   Re: [HELP] Player Model Menu
Reply With Quote #7

Quote:
Originally Posted by wickedd View Post
1.Learn how to use the edit button.
2.What game is this for?
It is for Team Fortress Classic.
DarthMan 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 20:43.


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