From 3d62b6f2ade8609aac6f1aa40f7b26b1914f930a Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 27 Jun 2020 15:30:23 +0200 Subject: [PATCH] Expose "server" and "dedicated" to Lua scripts Careful! Both are local variables and are always false for clients, and therefore should obviously not be used in anything gamelogic-related. --- src/dehacked.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index af576554f..2fae84160 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9718,12 +9718,12 @@ static inline int lib_getenum(lua_State *L) return 0; LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER); return 1; - /*} else if (fastcmp(word,"admin")) { - LUA_Deprecated(L, "admin", "IsPlayerAdmin(player)"); - if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer)) - return 0; - LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER); - return 1;*/ + } else if (fastcmp(word,"isserver")) { + lua_pushboolean(L, server); + return 1; + } else if (fastcmp(word, "isdedicatedserver")) { + lua_pushboolean(L, dedicated); + return 1; } else if (fastcmp(word,"gravity")) { lua_pushinteger(L, gravity); return 1;