mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
IsPlayerAdmin support, since admin was removed
This commit is contained in:
parent
68c46cdca3
commit
868118d0cd
2 changed files with 18 additions and 6 deletions
|
@ -9698,11 +9698,11 @@ static inline int lib_getenum(lua_State *L)
|
|||
return 0;
|
||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"admin")) {
|
||||
//if (!playeringame[adminplayer] || IsPlayerAdmin(serverplayer))
|
||||
//return 0;
|
||||
//LUA_PushUserdata(L, &players[adminplayer], META_PLAYER);
|
||||
return 1;
|
||||
/*} else if (fastcmp(word,"admin")) { // Replaced with IsPlayerAdmin
|
||||
if (!playeringame[adminplayer] || IsPlayerAdmin(serverplayer))
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[adminplayer], META_PLAYER);
|
||||
return 1;*/
|
||||
} else if (fastcmp(word,"emeralds")) {
|
||||
lua_pushinteger(L, emeralds);
|
||||
return 1;
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
#include "g_game.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "console.h"
|
||||
#include "k_kart.h"
|
||||
#include "k_kart.h" // SRB2Kart
|
||||
#include "d_netcmd.h" // IsPlayerAdmin
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
@ -142,6 +143,16 @@ static int lib_evalMath(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_isPlayerAdmin(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushboolean(L, IsPlayerAdmin(player-players));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// M_RANDOM
|
||||
//////////////
|
||||
|
||||
|
@ -2336,6 +2347,7 @@ static luaL_Reg lib[] = {
|
|||
{"chatprint", lib_chatprint},
|
||||
{"chatprintf", lib_chatprintf},
|
||||
{"EvalMath", lib_evalMath},
|
||||
{"IsPlayerAdmin", lib_isPlayerAdmin},
|
||||
|
||||
// m_random
|
||||
{"P_RandomFixed",lib_pRandomFixed},
|
||||
|
|
Loading…
Reference in a new issue