why not
parent
183e7b4a82
commit
bf75fbf690
|
@ -281,12 +281,22 @@ struct PLAYER_s *PLAYER_New(CBasePlayer *pPlayer)
|
|||
luaL_getmetatable(g_L, "PLAYER_s");
|
||||
lua_setmetatable(g_L, -2);
|
||||
|
||||
player->ply = pPlayer;
|
||||
player->pev = pPlayer->pev;
|
||||
|
||||
return player;
|
||||
}
|
||||
|
||||
struct PLAYER_s *PLAYER_New(entvars_t *pev)
|
||||
{
|
||||
struct PLAYER_s *player = (struct PLAYER_s *)lua_newuserdata(g_L, sizeof(struct PLAYER_s));
|
||||
luaL_getmetatable(g_L, "PLAYER_s");
|
||||
lua_setmetatable(g_L, -2);
|
||||
|
||||
player->pev = pev;
|
||||
|
||||
return player;
|
||||
}
|
||||
|
||||
static struct PLAYER_s *PLAYER_Get(lua_State *L)
|
||||
{
|
||||
struct PLAYER_s *player;
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
struct gsLuaRun_s
|
||||
{
|
||||
BOOL LRUN_CHLR_PLAYER_SPAWN = TRUE,
|
||||
LRUN_CHLR_PLAYER_THINK = TRUE;
|
||||
LRUN_CHLR_PLAYER_THINK = TRUE,
|
||||
LRUN_CHLR_PLAYER_KILLED = TRUE;
|
||||
};
|
||||
|
||||
struct PLAYER_s
|
||||
{
|
||||
CBasePlayer *ply;
|
||||
entvars_t *pev;
|
||||
};
|
||||
|
||||
|
@ -23,6 +23,7 @@ extern BOOL g_bLuaInitialized;
|
|||
extern struct gsLuaRun_s g_gsLuaRun;
|
||||
|
||||
struct PLAYER_s *PLAYER_New(CBasePlayer *pPlayer);
|
||||
struct PLAYER_s *PLAYER_New(entvars_t *pev);
|
||||
|
||||
void LuaInit(void);
|
||||
void LuaQuit(void);
|
||||
|
|
|
@ -196,6 +196,23 @@ int CHalfLifeRules :: IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKill
|
|||
//=========================================================
|
||||
void CHalfLifeRules :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
|
||||
{
|
||||
if(g_gsLuaRun.LRUN_CHLR_PLAYER_KILLED)
|
||||
{
|
||||
BOOL bRun;
|
||||
bRun = LuaGet("GAME", LUA_TTABLE, FALSE, FALSE);
|
||||
if(bRun) bRun = LuaGet("PlayerKilled", LUA_TFUNCTION, TRUE, FALSE);
|
||||
if(bRun)
|
||||
{
|
||||
PLAYER_New(pVictim);
|
||||
PLAYER_New(pKiller);
|
||||
PLAYER_New(pInflictor);
|
||||
LuaCall("GAME.PlayerKilled");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_gsLuaRun.LRUN_CHLR_PLAYER_KILLED = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
|
Loading…
Reference in New Issue