From d2f909981a09e98f22956c0390622734744b4c8e Mon Sep 17 00:00:00 2001 From: Freeman-AM Date: Sun, 18 May 2014 15:23:40 +0200 Subject: [PATCH] Telemenu: Use of float version of origin natives instead of integer version --- plugins/telemenu.sma | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/plugins/telemenu.sma b/plugins/telemenu.sma index d2d0b7a9..7c2874a8 100755 --- a/plugins/telemenu.sma +++ b/plugins/telemenu.sma @@ -34,13 +34,14 @@ #include #include -#include +#include -new g_menuPosition[33] -new g_menuPlayers[33][32] -new g_menuPlayersNum[33] -new g_menuOption[33] = {-1, ...} -new g_menuOrgin[33][3] +#define MAX_PLAYERS 32 + 1 +new g_menuPosition[MAX_PLAYERS] +new g_menuPlayers[MAX_PLAYERS][32] +new g_menuPlayersNum[MAX_PLAYERS] +new g_menuOption[MAX_PLAYERS] = {-1, ...} +new Float:g_menuOrigin[MAX_PLAYERS][3] new g_coloredMenus public plugin_init() @@ -67,8 +68,8 @@ public actionTelMenu(id, key) { if (g_menuOption[id] < 0) /* unlocking position for the first time */ g_menuOption[id] = 0 - - get_user_origin(id, g_menuOrgin[id]) + + pev(id, pev_origin, g_menuOrigin[id]) 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 name2[32] - + get_user_name(player, name2, 31) if (!is_user_alive(player)) @@ -89,12 +90,12 @@ public actionTelMenu(id, key) if (g_menuOption[id] > 0) { - set_user_origin(player, g_menuOrgin[id]) + engfunc(EngFunc_SetOrigin, player, g_menuOrigin[id]) } else { - new origin[3] - - get_user_origin(id, origin) - set_user_origin(player, origin) + new Float:f_origin[3] + + pev(id, pev_origin, f_origin) + engfunc(EngFunc_SetOrigin, player, f_origin) } 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) - 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]) } } - + return PLUGIN_HANDLED } displayTelMenu(id, pos) -{ +{ if (pos < 0) return @@ -146,14 +147,14 @@ displayTelMenu(id, pos) if (blockMenu || !is_user_alive(i) || (id != i && get_user_flags(i) & ADMIN_IMMUNITY)) { ++b - + if (g_coloredMenus) len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) else len += format(menuBody[len], 511-len, "#. %s^n", name) } else { keys |= (1< 0) // 1 { 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 {