Added client_spawn(id) & client_changeteam(id,newteam,oldteam) forwards

This commit is contained in:
Steve Dudenhoeffer 2004-09-10 13:57:10 +00:00
parent 07ed1baee9
commit 5867e3398f
4 changed files with 26 additions and 6 deletions

View File

@ -9,10 +9,18 @@ void CPlayer::PreThink()
Connect(); Connect();
bot=true; bot=true;
} }
if (olddeadflag && pev->deadflag == 0 && SpawnForward != -1)
MF_ExecuteForward(SpawnForward,index);
if (oldteam != pev->team && TeamForward != -1)
MF_ExecuteForward(TeamForward,index,pev->team,oldteam);
int tClass = GetClass(); int tClass = GetClass();
if (tClass != iclass) if (tClass != iclass)
ChangeClass(tClass); ChangeClass(tClass);
oldimpulse=pev->impulse; oldimpulse=pev->impulse;
olddeadflag = pev->deadflag;
oldteam = pev->team;
} }
void CPlayer::PreThink_Post() void CPlayer::PreThink_Post()
{ {
@ -34,7 +42,8 @@ void CPlayer::PostThink_Post()
} }
void CPlayer::ChangeClass(int newclass) void CPlayer::ChangeClass(int newclass)
{ {
MF_ExecuteForward(ChangeclassForward, index, newclass, iclass, oldimpulse); if (ChangeclassForward != -1)
MF_ExecuteForward(ChangeclassForward, index, newclass, iclass, oldimpulse);
iclass=newclass; iclass=newclass;
} }
@ -75,6 +84,7 @@ void CPlayer::Connect()
{ {
connected=true; connected=true;
bot=false; bot=false;
Reset(); Reset();
} }
void CPlayer::Disconnect() void CPlayer::Disconnect()
@ -95,4 +105,7 @@ void CPlayer::Reset()
this->body=0; this->body=0;
this->fov=0.0; this->fov=0.0;
this->foved=false; this->foved=false;
olddeadflag=0;
oldteam=0;
} }

View File

@ -19,6 +19,8 @@ public:
edict_t *edict; edict_t *edict;
entvars_t *pev; entvars_t *pev;
int oldimpulse; // Store the previous impulse. int oldimpulse; // Store the previous impulse.
int olddeadflag;
int oldteam;
int index; int index;
bool connected; bool connected;

View File

@ -10,9 +10,10 @@ CPlayer g_player[33];
edict_t *player_edicts[33]; edict_t *player_edicts[33];
int gmsgHudText2=0; int gmsgHudText2=0;
int ChangeclassForward = 0; int ChangeclassForward = -1;
int BuiltForward = 0; int BuiltForward = -1;
int SpawnForward = -1;
int TeamForward = -1;
// Index of last entity hooked in CreateNamedEntity // Index of last entity hooked in CreateNamedEntity
int iCreateEntityIndex; int iCreateEntityIndex;
BOOL iscombat; BOOL iscombat;
@ -41,6 +42,8 @@ void OnPluginsLoaded()
// No sense in this if it's combat.. // No sense in this if it's combat..
if (!iscombat) if (!iscombat)
BuiltForward = MF_RegisterForward("client_built", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE); BuiltForward = MF_RegisterForward("client_built", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
SpawnForward = MF_RegisterForward("client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
TeamForward = MF_RegisterForward("client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*new team*/,FP_CELL/*old team*/,FP_DONE);
} }
@ -272,7 +275,8 @@ void AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
iForward = 1; iForward = 1;
} }
// ns2amx_built.execute(index,iCreateEntityIndex,iForward,iType); // ns2amx_built.execute(index,iCreateEntityIndex,iForward,iType);
MF_ExecuteForward(BuiltForward, index, iCreateEntityIndex, iForward, iType); if (BuiltForward != -1)
MF_ExecuteForward(BuiltForward, index, iCreateEntityIndex, iForward, iType);
iCreateEntityIndex=0; iCreateEntityIndex=0;
} }
} }

View File

@ -23,7 +23,8 @@ extern int gmsgHudText2;
extern AMX_NATIVE_INFO ns_misc_natives[]; extern AMX_NATIVE_INFO ns_misc_natives[];
extern AMX_NATIVE_INFO ns_pdata_natives[]; extern AMX_NATIVE_INFO ns_pdata_natives[];
extern int SpawnForward;
extern int TeamForward;
extern int ChangeclassForward; extern int ChangeclassForward;
extern int BuiltForward; extern int BuiltForward;