Telemenu: Use of float version of origin natives instead of integer version

This commit is contained in:
Freeman-AM 2014-05-18 15:23:40 +02:00
parent aa00fc6f63
commit d2f909981a

View File

@ -34,13 +34,14 @@
#include <amxmodx> #include <amxmodx>
#include <amxmisc> #include <amxmisc>
#include <fun> #include <fakemeta>
new g_menuPosition[33] #define MAX_PLAYERS 32 + 1
new g_menuPlayers[33][32] new g_menuPosition[MAX_PLAYERS]
new g_menuPlayersNum[33] new g_menuPlayers[MAX_PLAYERS][32]
new g_menuOption[33] = {-1, ...} new g_menuPlayersNum[MAX_PLAYERS]
new g_menuOrgin[33][3] new g_menuOption[MAX_PLAYERS] = {-1, ...}
new Float:g_menuOrigin[MAX_PLAYERS][3]
new g_coloredMenus new g_coloredMenus
public plugin_init() public plugin_init()
@ -67,8 +68,8 @@ public actionTelMenu(id, key)
{ {
if (g_menuOption[id] < 0) /* unlocking position for the first time */ if (g_menuOption[id] < 0) /* unlocking position for the first time */
g_menuOption[id] = 0 g_menuOption[id] = 0
get_user_origin(id, g_menuOrgin[id]) pev(id, pev_origin, g_menuOrigin[id])
displayTelMenu(id, g_menuPosition[id]) displayTelMenu(id, g_menuPosition[id])
} }
case 8: displayTelMenu(id, ++g_menuPosition[id]) case 8: displayTelMenu(id, ++g_menuPosition[id])
@ -77,7 +78,7 @@ public actionTelMenu(id, key)
{ {
new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
new name2[32] new name2[32]
get_user_name(player, name2, 31) get_user_name(player, name2, 31)
if (!is_user_alive(player)) if (!is_user_alive(player))
@ -89,12 +90,12 @@ public actionTelMenu(id, key)
if (g_menuOption[id] > 0) if (g_menuOption[id] > 0)
{ {
set_user_origin(player, g_menuOrgin[id]) engfunc(EngFunc_SetOrigin, player, g_menuOrigin[id])
} else { } else {
new origin[3] new Float:f_origin[3]
get_user_origin(id, origin) pev(id, pev_origin, f_origin)
set_user_origin(player, origin) engfunc(EngFunc_SetOrigin, player, f_origin)
} }
new authid[32], authid2[32], name[32] new authid[32], authid2[32], name[32]
@ -105,17 +106,17 @@ public actionTelMenu(id, key)
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2) log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
show_activity_key("ADMIN_TELEPORT_1", "ADMIN_TELEPORT_2", name, name2); show_activity_key("ADMIN_TELEPORT_1", "ADMIN_TELEPORT_2", name, name2)
displayTelMenu(id, g_menuPosition[id]) displayTelMenu(id, g_menuPosition[id])
} }
} }
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayTelMenu(id, pos) displayTelMenu(id, pos)
{ {
if (pos < 0) if (pos < 0)
return return
@ -146,14 +147,14 @@ displayTelMenu(id, pos)
if (blockMenu || !is_user_alive(i) || (id != i && get_user_flags(i) & ADMIN_IMMUNITY)) if (blockMenu || !is_user_alive(i) || (id != i && get_user_flags(i) & ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], 511-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
@ -164,7 +165,7 @@ displayTelMenu(id, pos)
if (g_menuOption[id] > 0) // 1 if (g_menuOption[id] > 0) // 1
{ {
keys |= MENU_KEY_7 keys |= MENU_KEY_7
len += format(menuBody[len], 511-len, "^n7. To location: %d %d %d^n", g_menuOrgin[id][0], g_menuOrgin[id][1], g_menuOrgin[id][2]) len += format(menuBody[len], 511-len, "^n7. To location: %.0f %.0f %.0f^n", g_menuOrigin[id][0], g_menuOrigin[id][1], g_menuOrigin[id][2])
} }
else if (g_menuOption[id]) // -1 else if (g_menuOption[id]) // -1
{ {