Move slay as last option instead of first in Slay/Slap Menu (bug 5861, r=arkshine)
authorconnorr
Sat Aug 24 01:14:54 2013 +0200 (2013-08-24)
changeset 18490ade3da43fa
parent 183 d9193ef87acc
child 185 15c0ede492bc
Move slay as last option instead of first in Slay/Slap Menu (bug 5861, r=arkshine)
configs/amxx.cfg
configs/cstrike/amxx.cfg
configs/ns/amxx.cfg
plugins/ns/plmenu.sma
plugins/plmenu.sma
     1.1 --- a/configs/amxx.cfg	Sat Aug 24 01:03:13 2013 +0200
     1.2 +++ b/configs/amxx.cfg	Sat Aug 24 01:14:54 2013 +0200
     1.3 @@ -60,7 +60,7 @@
     1.4  amx_tempban_maxtime 4320
     1.5  
     1.6  // Slap damage amounts for the main slap menu (amx_slapmenu)
     1.7 -// Slay is automatically inserted as the first option.
     1.8 +// Slay is automatically inserted as the last option.
     1.9  // Default values: 0 1 5
    1.10  amx_plmenu_slapdmg 0 1 5
    1.11  
     2.1 --- a/configs/cstrike/amxx.cfg	Sat Aug 24 01:03:13 2013 +0200
     2.2 +++ b/configs/cstrike/amxx.cfg	Sat Aug 24 01:14:54 2013 +0200
     2.3 @@ -60,7 +60,7 @@
     2.4  amx_tempban_maxtime 4320
     2.5  
     2.6  // Slap damage amounts for the main slap menu (amx_slapmenu)
     2.7 -// Slay is automaticall inserted as the first option
     2.8 +// Slay is automaticall inserted as the last option
     2.9  // Default values: 0 1 5
    2.10  amx_plmenu_slapdmg 0 1 5
    2.11  
     3.1 --- a/configs/ns/amxx.cfg	Sat Aug 24 01:03:13 2013 +0200
     3.2 +++ b/configs/ns/amxx.cfg	Sat Aug 24 01:14:54 2013 +0200
     3.3 @@ -60,7 +60,7 @@
     3.4  amx_tempban_maxtime 4320
     3.5  
     3.6  // Slap damage amounts for the main slap menu (amx_slapmenu)
     3.7 -// Slay is automatically inserted as the first option.
     3.8 +// Slay is automatically inserted as the last option.
     3.9  // Default values: 0 1 5
    3.10  amx_plmenu_slapdamage 0 1 5
    3.11  
     4.1 --- a/plugins/ns/plmenu.sma	Sat Aug 24 01:03:13 2013 +0200
     4.2 +++ b/plugins/ns/plmenu.sma	Sat Aug 24 01:14:54 2013 +0200
     4.3 @@ -154,9 +154,10 @@
     4.4  	
     4.5  	g_slapsettings = ArrayCreate();
     4.6  	// Old default values
     4.7 -	ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
     4.8 +	ArrayPushCell(g_slapsettings, 0); // slap 0 damage
     4.9  	ArrayPushCell(g_slapsettings, 1);
    4.10  	ArrayPushCell(g_slapsettings, 5);
    4.11 +	ArrayPushCell(g_slapsettings, 0); // Last option is ignored - it is slay
    4.12  	
    4.13  	
    4.14  	register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
    4.15 @@ -278,15 +279,13 @@
    4.16  	if (args <= 1)
    4.17  	{
    4.18  		server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
    4.19 -		server_print("   slay is automatically set for the first value.");
    4.20 +		server_print("   slay is automatically set for the last value.");
    4.21  		
    4.22  		return;
    4.23  	}
    4.24  	
    4.25  	ArrayClear(g_slapsettings);
    4.26  	
    4.27 -	ArrayPushCell(g_slapsettings, 0); // compensate for slay
    4.28 -	
    4.29  	for (new i = 1; i < args; i++)
    4.30  	{
    4.31  		read_argv(i, buff, charsmax(buff));
    4.32 @@ -294,7 +293,7 @@
    4.33  		ArrayPushCell(g_slapsettings, str_to_num(buff));
    4.34  		
    4.35  	}
    4.36 -	
    4.37 +	ArrayPushCell(g_slapsettings, 0); // compensate for slay
    4.38  }
    4.39  
    4.40  /* Ban menu */
    4.41 @@ -509,22 +508,22 @@
    4.42  			get_user_authid(player, authid2, 31)
    4.43  			get_user_name(id, name, 31)
    4.44  
    4.45 -			if (g_menuOption[id])
    4.46 +			new aSize = ArraySize(g_slapsettings);
    4.47 +			if (aSize > 1 && g_menuOption[id] < aSize -1)
    4.48  			{
    4.49  				log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, g_menuSettings[id], name2, get_user_userid(player), authid2)
    4.50 -
    4.51 +				
    4.52  				show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
    4.53 -			} else {
    4.54 +				
    4.55 +				user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
    4.56 +			} else { // aSize == 1 or g_menuOption[id] == aSize - 1 // last option
    4.57  				log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
    4.58  				
    4.59  				show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
    4.60 +				
    4.61 +				user_kill(player)
    4.62  			}
    4.63 -
    4.64 -			if (g_menuOption[id])
    4.65 -				user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
    4.66 -			else
    4.67 -				user_kill(player)
    4.68 -
    4.69 +			
    4.70  			displaySlapMenu(id, g_menuPosition[id])
    4.71  		}
    4.72  	}
    4.73 @@ -577,10 +576,10 @@
    4.74  		}
    4.75  	}
    4.76  
    4.77 -	if (g_menuOption[id])
    4.78 +	if (g_menuOption[id] == ArraySize(g_slapsettings) - 1)
    4.79 +		len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
    4.80 +	else
    4.81  		len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
    4.82 -	else
    4.83 -		len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
    4.84  
    4.85  	if (end != g_menuPlayersNum[id])
    4.86  	{
     5.1 --- a/plugins/plmenu.sma	Sat Aug 24 01:03:13 2013 +0200
     5.2 +++ b/plugins/plmenu.sma	Sat Aug 24 01:14:54 2013 +0200
     5.3 @@ -126,10 +126,10 @@
     5.4  	
     5.5  	g_slapsettings = ArrayCreate();
     5.6  	// Old default values
     5.7 -	ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
     5.8  	ArrayPushCell(g_slapsettings, 0); // slap 0 damage
     5.9  	ArrayPushCell(g_slapsettings, 1);
    5.10  	ArrayPushCell(g_slapsettings, 5);
    5.11 +	ArrayPushCell(g_slapsettings, 0); // Last option is ignored - it is slay
    5.12  	
    5.13  	
    5.14  	register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
    5.15 @@ -212,15 +212,13 @@
    5.16  	if (args <= 1)
    5.17  	{
    5.18  		server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
    5.19 -		server_print("   slay is automatically set for the first value.");
    5.20 +		server_print("   slay is automatically set for the last value.");
    5.21  		
    5.22  		return;
    5.23  	}
    5.24  	
    5.25  	ArrayClear(g_slapsettings);
    5.26  	
    5.27 -	ArrayPushCell(g_slapsettings, 0); // compensate for slay
    5.28 -	
    5.29  	for (new i = 1; i < args; i++)
    5.30  	{
    5.31  		read_argv(i, buff, charsmax(buff));
    5.32 @@ -228,7 +226,7 @@
    5.33  		ArrayPushCell(g_slapsettings, str_to_num(buff));
    5.34  		
    5.35  	}
    5.36 -	
    5.37 +	ArrayPushCell(g_slapsettings, 0); // compensate for slay
    5.38  }
    5.39  public module_filter(const module[])
    5.40  {
    5.41 @@ -461,22 +459,22 @@
    5.42  			get_user_authid(player, authid2, 31)
    5.43  			get_user_name(id, name, 31)
    5.44  
    5.45 -			if (g_menuOption[id])
    5.46 +			new aSize = ArraySize(g_slapsettings);
    5.47 +			if (aSize > 1 && g_menuOption[id] < aSize -1)
    5.48  			{
    5.49  				log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, g_menuSettings[id], name2, get_user_userid(player), authid2)
    5.50  
    5.51  				show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
    5.52 -			} else {
    5.53 +				
    5.54 +				user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
    5.55 +			} else { // aSize == 1 or g_menuOption[id] == aSize - 1 // last option
    5.56  				log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
    5.57  				
    5.58  				show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
    5.59 +				
    5.60 +				user_kill(player)
    5.61  			}
    5.62  
    5.63 -			if (g_menuOption[id])
    5.64 -				user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
    5.65 -			else
    5.66 -				user_kill(player)
    5.67 -
    5.68  			displaySlapMenu(id, g_menuPosition[id])
    5.69  		}
    5.70  	}
    5.71 @@ -546,10 +544,10 @@
    5.72  		}
    5.73  	}
    5.74  
    5.75 -	if (g_menuOption[id])
    5.76 +	if (g_menuOption[id] == ArraySize(g_slapsettings) - 1)
    5.77 +		len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
    5.78 +	else
    5.79  		len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
    5.80 -	else
    5.81 -		len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
    5.82  
    5.83  	if (end != g_menuPlayersNum[id])
    5.84  	{