View Single Post
Author Message
Contf
Junior Member
Join Date: Jun 2013
Old 06-28-2013 , 13:35   UserFlags Restrict access
Reply With Quote #1

Hi guys.
During the last days I tried to solve the problem by looking in the forum about how to restrict access to a menu if the player does not have the necessary flags, however I could not.

warning 217: loose identation

Code:
new vipflag[ACCESSFLAG_MAX_LENGTH] = "m"
new adminflag[ACCESSFLAG_MAX_LENGTH] = "a"
Code:
public duel_menu(id)
{	
         new userflags = get_user_flags(id)
	if (userflags & (read_flags(adminflag) | read_flags(adminflag)))
	{ 
	if(is_user_alive(id))
	{                  
	static opcion[64]
	
	formatex(opcion, charsmax(opcion),"\y%L", LANG_PLAYER, "VIPMENU")
	new iMenu = menu_create(opcion, "menu")
	
	formatex(opcion, charsmax(opcion),"\w%L", LANG_PLAYER, "VIP_LOJA")
	menu_additem(iMenu, opcion, "1")	
	
	formatex(opcion, charsmax(opcion),"\w%L", LANG_PLAYER, "VIP_FACA")
	menu_additem(iMenu, opcion, "2")
	
	formatex(opcion, charsmax(opcion),"\w%L", LANG_PLAYER, "mpacks")
	menu_additem(iMenu, opcion, "3")
		
	menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
	menu_display(id, iMenu, 0)
										
	return PLUGIN_HANDLED
	}
	else
			{
				ChatColor(id, "%L", LANG_PLAYER, "DEAD")
			}
	}
         	 
	else if (userflags & (read_flags(vipflag) | read_flags(vipflag)))
	{ 
	if(is_user_alive(id))
	{ 
	if (cs_get_user_team(id) == CS_TEAM_T )
	{ 	
	static opcion[64]
	
	formatex(opcion, charsmax(opcion),"\y%L", LANG_PLAYER, "VipMenu")
	new iMenu = menu_create(opcion, "menu")
	
	formatex(opcion, charsmax(opcion),"\w%L", LANG_PLAYER, "VIP_LOJA")
	menu_additem(iMenu, opcion, "1")	
	
	formatex(opcion, charsmax(opcion),"\w%L", LANG_PLAYER, "VIP_FACA")
	menu_additem(iMenu, opcion, "2")
			
	menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
	menu_display(id, iMenu, 0)
			     
	return PLUGIN_HANDLED
	}
         else
				{
					ChatColor(id, "%L", LANG_PLAYER, "ONLYVIP")
				}
	}
	else
			{
				ChatColor(id, "%L", LANG_PLAYER, "DEAD")
			}
	}
	return PLUGIN_HANDLED
}
I appreciate if someone help.
Attached Files
File Type: sma Get Plugin or Get Source (shopvip.sma - 600 views - 35.6 KB)

Last edited by Contf; 06-28-2013 at 13:39. Reason: forget to add some code
Contf is offline