Raised This Month: $ Target: $400
 0% 

Solved Format HELP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-02-2017 , 05:44   Format HELP
Reply With Quote #1

Hello. I need help with formatex or format for my menu. Wo, when u prees the models key, it displays the models from the ini, but the problem is that it displays the whole line. I would like it to only display g_line_model and not also g_line_skins. They're separated by "" so like that : "penguin_r" "10" , for example.In penguin_r case, I would like the menu to only display penguin_r and not "penguin_r" "10".

Code:
for (new i; (i < file_size(conffile_model, 1)); i++)
		{
			read_file(conffile_model, i, g_model_num, 127, leng)
			menu_additem(menu_model, g_model_num, "", 0);
		}
This script is sued to display the models in the menu, but it still used the old read_file system, because I am more used to it that the enw one, which lacks some things like like,text and length.

Thanks!

Last edited by Bugsy; 03-03-2017 at 20:50.
DarthMan is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-02-2017 , 07:18   Re: Format HELP
Reply With Quote #2

PHP Code:
// "penguin_r" "10"

new szLine[64], iLen
read_file
(iFileiLineszLinecharsmax(szLine), iLen)
// Result: szLine = "model name" "10"

new szModel[32], szNumber[32]
parse(szLineszModelcharsmax(szModel), szNumbercharsmax(szNumber))
// Result: szModel = penguin_r
// Result: szNumber = 10 
__________________

Last edited by OciXCrom; 03-02-2017 at 07:19.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-02-2017 , 08:15   Re: Format HELP
Reply With Quote #3

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

new g_Vault;               //Global var to hold our vault handle
new g_Vault_2;
new g_szAuthID[35];    //Global array to store auth ids of players
new g_iArraySize
new Array:g_models

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)
	g_models = ArrayCreate(128, 32)
	fileRead()
}

fileRead()
{
	new szConfigsName[256], szFilename[256]
	get_configsdir(szConfigsName, charsmax(szConfigsName))
	formatex(szFilename, charsmax(szFilename), "%s/models.ini", szConfigsName)
	new iFilePointer = fopen(szFilename, "rt")
	
	if(iFilePointer)
	{
		new szData[128]
		
		while(!feof(iFilePointer))
		{
			fgets(iFilePointer, szData, charsmax(szData))
			trim(szData)
			
			if(szData[0] == EOS || szData[0] == ';')
				continue
				
			ArrayPushString(g_models, szData)
		}
		
		g_iArraySize = ArraySize(g_models)
		fclose(iFilePointer)
	}
}    

public mh_PMenu(id, menu, item)
{
	new szItem[128];
	if(item == MENU_EXIT)
	{
		menu_cancel(id);
		return PLUGIN_HANDLED;
	}

	new command[6], name[64], access, callback;
	//new local_models[128], local_skins[128],  lineIn[128];

	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 < g_iArraySize; i++)
		{
			ArrayGetString(g_models, i, szItem, charsmax(szItem))
			menu_additem(menu_model, szItem, "", 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;
}
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-02-2017 , 09:17   Re: Format HELP
Reply With Quote #4

Problem solved

Last edited by DarthMan; 03-02-2017 at 09:44.
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 21:02.


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