Move slay as last option instead of first in Slay/Slap Menu (bug 5861, r=arkshine)
Former-commit-id: 31f5fdfa9788d5ea8552e2dc101c582e7959ecc0
This commit is contained in:
parent
af0a1200ab
commit
3b6c207ea8
|
@ -60,7 +60,7 @@ amx_plmenu_bantimes 0 5 10 15 30 45 60
|
||||||
amx_tempban_maxtime 4320
|
amx_tempban_maxtime 4320
|
||||||
|
|
||||||
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
||||||
// Slay is automatically inserted as the first option.
|
// Slay is automatically inserted as the last option.
|
||||||
// Default values: 0 1 5
|
// Default values: 0 1 5
|
||||||
amx_plmenu_slapdmg 0 1 5
|
amx_plmenu_slapdmg 0 1 5
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ amx_plmenu_bantimes 0 5 10 15 30 45 60
|
||||||
amx_tempban_maxtime 4320
|
amx_tempban_maxtime 4320
|
||||||
|
|
||||||
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
||||||
// Slay is automaticall inserted as the first option
|
// Slay is automaticall inserted as the last option
|
||||||
// Default values: 0 1 5
|
// Default values: 0 1 5
|
||||||
amx_plmenu_slapdmg 0 1 5
|
amx_plmenu_slapdmg 0 1 5
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ amx_plmenu_bantimes 0 5 10 15 30 45 60
|
||||||
amx_tempban_maxtime 4320
|
amx_tempban_maxtime 4320
|
||||||
|
|
||||||
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
||||||
// Slay is automatically inserted as the first option.
|
// Slay is automatically inserted as the last option.
|
||||||
// Default values: 0 1 5
|
// Default values: 0 1 5
|
||||||
amx_plmenu_slapdamage 0 1 5
|
amx_plmenu_slapdamage 0 1 5
|
||||||
|
|
||||||
|
|
|
@ -154,9 +154,10 @@ public plugin_init()
|
||||||
|
|
||||||
g_slapsettings = ArrayCreate();
|
g_slapsettings = ArrayCreate();
|
||||||
// Old default values
|
// Old default values
|
||||||
ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
|
ArrayPushCell(g_slapsettings, 0); // slap 0 damage
|
||||||
ArrayPushCell(g_slapsettings, 1);
|
ArrayPushCell(g_slapsettings, 1);
|
||||||
ArrayPushCell(g_slapsettings, 5);
|
ArrayPushCell(g_slapsettings, 5);
|
||||||
|
ArrayPushCell(g_slapsettings, 0); // Last option is ignored - it is slay
|
||||||
|
|
||||||
|
|
||||||
register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
|
register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
|
||||||
|
@ -278,15 +279,13 @@ public plmenu_setslapdmg()
|
||||||
if (args <= 1)
|
if (args <= 1)
|
||||||
{
|
{
|
||||||
server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
|
server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
|
||||||
server_print(" slay is automatically set for the first value.");
|
server_print(" slay is automatically set for the last value.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayClear(g_slapsettings);
|
ArrayClear(g_slapsettings);
|
||||||
|
|
||||||
ArrayPushCell(g_slapsettings, 0); // compensate for slay
|
|
||||||
|
|
||||||
for (new i = 1; i < args; i++)
|
for (new i = 1; i < args; i++)
|
||||||
{
|
{
|
||||||
read_argv(i, buff, charsmax(buff));
|
read_argv(i, buff, charsmax(buff));
|
||||||
|
@ -294,7 +293,7 @@ public plmenu_setslapdmg()
|
||||||
ArrayPushCell(g_slapsettings, str_to_num(buff));
|
ArrayPushCell(g_slapsettings, str_to_num(buff));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ArrayPushCell(g_slapsettings, 0); // compensate for slay
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ban menu */
|
/* Ban menu */
|
||||||
|
@ -509,21 +508,21 @@ public actionSlapMenu(id, key)
|
||||||
get_user_authid(player, authid2, 31)
|
get_user_authid(player, authid2, 31)
|
||||||
get_user_name(id, name, 31)
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
if (g_menuOption[id])
|
new aSize = ArraySize(g_slapsettings);
|
||||||
|
if (aSize > 1 && g_menuOption[id] < aSize -1)
|
||||||
{
|
{
|
||||||
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)
|
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)
|
||||||
|
|
||||||
show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
|
show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
|
||||||
} else {
|
|
||||||
|
user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
|
||||||
|
} else { // aSize == 1 or g_menuOption[id] == aSize - 1 // last option
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
|
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
|
||||||
|
|
||||||
show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
|
show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
|
||||||
}
|
|
||||||
|
|
||||||
if (g_menuOption[id])
|
|
||||||
user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
|
|
||||||
else
|
|
||||||
user_kill(player)
|
user_kill(player)
|
||||||
|
}
|
||||||
|
|
||||||
displaySlapMenu(id, g_menuPosition[id])
|
displaySlapMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
|
@ -577,10 +576,10 @@ displaySlapMenu(id, pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_menuOption[id])
|
if (g_menuOption[id] == ArraySize(g_slapsettings) - 1)
|
||||||
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
|
|
||||||
else
|
|
||||||
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
|
||||||
|
else
|
||||||
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id])
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,10 +126,10 @@ public plugin_init()
|
||||||
|
|
||||||
g_slapsettings = ArrayCreate();
|
g_slapsettings = ArrayCreate();
|
||||||
// Old default values
|
// Old default values
|
||||||
ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
|
|
||||||
ArrayPushCell(g_slapsettings, 0); // slap 0 damage
|
ArrayPushCell(g_slapsettings, 0); // slap 0 damage
|
||||||
ArrayPushCell(g_slapsettings, 1);
|
ArrayPushCell(g_slapsettings, 1);
|
||||||
ArrayPushCell(g_slapsettings, 5);
|
ArrayPushCell(g_slapsettings, 5);
|
||||||
|
ArrayPushCell(g_slapsettings, 0); // Last option is ignored - it is slay
|
||||||
|
|
||||||
|
|
||||||
register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
|
register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
|
||||||
|
@ -212,15 +212,13 @@ public plmenu_setslapdmg()
|
||||||
if (args <= 1)
|
if (args <= 1)
|
||||||
{
|
{
|
||||||
server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
|
server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
|
||||||
server_print(" slay is automatically set for the first value.");
|
server_print(" slay is automatically set for the last value.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayClear(g_slapsettings);
|
ArrayClear(g_slapsettings);
|
||||||
|
|
||||||
ArrayPushCell(g_slapsettings, 0); // compensate for slay
|
|
||||||
|
|
||||||
for (new i = 1; i < args; i++)
|
for (new i = 1; i < args; i++)
|
||||||
{
|
{
|
||||||
read_argv(i, buff, charsmax(buff));
|
read_argv(i, buff, charsmax(buff));
|
||||||
|
@ -228,7 +226,7 @@ public plmenu_setslapdmg()
|
||||||
ArrayPushCell(g_slapsettings, str_to_num(buff));
|
ArrayPushCell(g_slapsettings, str_to_num(buff));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ArrayPushCell(g_slapsettings, 0); // compensate for slay
|
||||||
}
|
}
|
||||||
public module_filter(const module[])
|
public module_filter(const module[])
|
||||||
{
|
{
|
||||||
|
@ -461,21 +459,21 @@ public actionSlapMenu(id, key)
|
||||||
get_user_authid(player, authid2, 31)
|
get_user_authid(player, authid2, 31)
|
||||||
get_user_name(id, name, 31)
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
if (g_menuOption[id])
|
new aSize = ArraySize(g_slapsettings);
|
||||||
|
if (aSize > 1 && g_menuOption[id] < aSize -1)
|
||||||
{
|
{
|
||||||
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)
|
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)
|
||||||
|
|
||||||
show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
|
show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
|
||||||
} else {
|
|
||||||
|
user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
|
||||||
|
} else { // aSize == 1 or g_menuOption[id] == aSize - 1 // last option
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
|
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
|
||||||
|
|
||||||
show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
|
show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
|
||||||
}
|
|
||||||
|
|
||||||
if (g_menuOption[id])
|
|
||||||
user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
|
|
||||||
else
|
|
||||||
user_kill(player)
|
user_kill(player)
|
||||||
|
}
|
||||||
|
|
||||||
displaySlapMenu(id, g_menuPosition[id])
|
displaySlapMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
|
@ -546,10 +544,10 @@ displaySlapMenu(id, pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_menuOption[id])
|
if (g_menuOption[id] == ArraySize(g_slapsettings) - 1)
|
||||||
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
|
|
||||||
else
|
|
||||||
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
|
||||||
|
else
|
||||||
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user