Raised This Month: $ Target: $400
 0% 

Menu with different options if conditions are met


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Gasior
Member
Join Date: Mar 2012
Old 02-08-2017 , 14:39   Menu with different options if conditions are met
Reply With Quote #1

Hi Guys,

So just to explain, what I am trying to do is have a menu of weapons with different skins available for players if they have purchased it.

Problem I have is that if I select Carbon from the menu but I don't have Burner available then I will receive model Burner rather than Carbon. Simply because if I don't have option Burner than option Carbon is first and responds to case 0. How do I show things in the menu but don't let players choose it unless my condition is met?

I know I am confusing but I cannot explain it clearer. Please ask questions, I will answer all of them for help .

Code:
 public display_pistolet(id)  
{ 
	new g_Menu = menu_create("Wybierz swoj \rGLOCK!", "glock_handle");
    
	if(Burner1[id] > 0){
	menu_additem(g_Menu, "\wBurner^n" ); 
	}
	if(Carbon1[id] > 0){
	menu_additem(g_Menu, "\wCarbon", "", 0);
	}
	if(Crimson1[id] > 0){
	menu_additem(g_Menu, "\wCrimson", "", 0);
	}
	if(Gradient1[id] > 0){
	menu_additem(g_Menu, "\wGradient", "", 0);
	}
	if(Krolewski1[id] > 0){
	menu_additem(g_Menu, "\wKrolewksi", "", 0);
	}
	menu_additem(g_Menu, "\wStandardowy\w^n" ); 
	menu_addtext(g_Menu, "Odwiedz nas na \rProjektSpark.pl^n" , 0 ); 

	menu_setprop(g_Menu, MPROP_EXIT, MEXIT_ALL);
	menu_setprop(g_Menu, MPROP_BACKNAME, "Wroc");
	menu_setprop(g_Menu, MPROP_NEXTNAME, "Nastepna Strona");
	menu_setprop(g_Menu, MPROP_EXITNAME, "Wyjdz");
	menu_setprop(g_Menu, MPROP_NOCOLORS, 1);

	menu_display(id, g_Menu, 0);

	return PLUGIN_HANDLED;
} 

public glock_handle(id, menu, item) 
{ 
	if(is_user_connected( id ))
	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: SetGlock( id , Glocks:Burner );
		case 1: SetGlock( id , Glocks:Carbon );
		case 2: SetGlock( id , Glocks:Crimson );
		case 3: SetGlock( id , Glocks:Gradient );
		case 4: SetGlock( id , Glocks:Krolewski );
		case 5: SetGlock( id , Glocks:Standardowy );
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
Gasior is offline
 


Thread Tools
Display Modes

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:42.


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