attempted merge at 1.77 back into trunk... Oh MY GOD
This commit is contained in:
@ -32,6 +32,8 @@
|
||||
#include "amxxmodule.h"
|
||||
#include "tfcx.h"
|
||||
|
||||
extern int g_AlliesFlags[4];
|
||||
|
||||
// Vexd start
|
||||
|
||||
// Set A TFC Player's model. This works differently then CS.
|
||||
@ -429,6 +431,60 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL TFC_IsFeigning(AMX *amx, cell *params)
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_PLAYER(index);
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
|
||||
return (pPlayer->pEdict->v.playerclass == TFC_PC_SPY && pPlayer->pEdict->v.deadflag == 5);
|
||||
};
|
||||
cvar_t *mp_teamplay=NULL;
|
||||
static cell AMX_NATIVE_CALL TFC_IsTeamAlly(AMX *amx, cell *params)
|
||||
{
|
||||
if (mp_teamplay==NULL)
|
||||
{
|
||||
mp_teamplay=CVAR_GET_POINTER("mp_teamplay");
|
||||
}
|
||||
|
||||
if (mp_teamplay && mp_teamplay->value != 0.0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int TeamA=params[1];
|
||||
int TeamB=params[2];
|
||||
if (TeamA==TeamB) // same team, yes these are allies
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (TeamA==0 || TeamB==0) // spectators
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (TeamA < 1 || TeamA > 4) // out of bounds?
|
||||
{
|
||||
MF_LogError(amx,AMX_ERR_NATIVE,"Team A is out of bounds (got %d, expected 0 through 4)",TeamA);
|
||||
return 0;
|
||||
}
|
||||
if (TeamB < 1 || TeamB > 4) // out of bounds?
|
||||
{
|
||||
MF_LogError(amx,AMX_ERR_NATIVE,"Team B is out of bounds (got %d, expected 0 through 4)",TeamA);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_AlliesFlags[--TeamA] & (1<<(--TeamB)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
// Native list.
|
||||
AMX_NATIVE_INFO base_Natives[] = {
|
||||
{"tfc_setmodel", TFC_SetModel},
|
||||
@ -440,6 +496,10 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
{"tfc_getweaponammo", TFC_GetWeaponAmmo},
|
||||
{"tfc_setweaponammo", TFC_SetWeaponAmmo},
|
||||
|
||||
{"tfc_is_user_feigning", TFC_IsFeigning},
|
||||
|
||||
{"tfc_is_team_ally", TFC_IsTeamAlly},
|
||||
|
||||
{"tfc_get_user_goalitem", TFC_GetUserGoalItem},
|
||||
|
||||
{"xmod_get_wpnname", TFC_GetWpnName},
|
||||
|
@ -58,6 +58,8 @@ int mPlayerIndex;
|
||||
int g_death_info = -1;
|
||||
int g_damage_info = -1;
|
||||
|
||||
int g_AlliesFlags[4];
|
||||
|
||||
RankSystem g_rank;
|
||||
Grenades g_grenades;
|
||||
|
||||
@ -166,7 +168,13 @@ void ServerDeactivate() {
|
||||
weaponData[i].ammoSlot = false;
|
||||
|
||||
g_grenades.clear();
|
||||
|
||||
|
||||
g_AlliesFlags[0]=0;
|
||||
g_AlliesFlags[1]=0;
|
||||
g_AlliesFlags[2]=0;
|
||||
g_AlliesFlags[3]=0;
|
||||
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
@ -349,6 +357,10 @@ void OnAmxxAttach() {
|
||||
pdAmmo[TFC_AMMO_NADE1] = PD_AMMO_NADE1;
|
||||
pdAmmo[TFC_AMMO_NADE2] = PD_AMMO_NADE2;
|
||||
|
||||
g_AlliesFlags[0]=0;
|
||||
g_AlliesFlags[1]=0;
|
||||
g_AlliesFlags[2]=0;
|
||||
g_AlliesFlags[3]=0;
|
||||
}
|
||||
|
||||
void OnPluginsLoaded()
|
||||
@ -357,3 +369,37 @@ void OnPluginsLoaded()
|
||||
g_death_info = MF_RegisterForward("client_death", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
}
|
||||
|
||||
void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
|
||||
{
|
||||
if (pkvd->szClassName && strcmp(pkvd->szClassName,"info_tfdetect")==0)
|
||||
{
|
||||
if (pkvd->szKeyName && strncmp(pkvd->szKeyName,"team",4)==0)
|
||||
{
|
||||
if (strcmp(pkvd->szKeyName,"team1_allies")==0 && pkvd->szValue!=NULL)
|
||||
{
|
||||
g_AlliesFlags[0]=atoi(pkvd->szValue);
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
else if (strcmp(pkvd->szKeyName,"team2_allies")==0 && pkvd->szValue!=NULL)
|
||||
{
|
||||
g_AlliesFlags[1]=atoi(pkvd->szValue);
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
else if (strcmp(pkvd->szKeyName,"team3_allies")==0 && pkvd->szValue!=NULL)
|
||||
{
|
||||
g_AlliesFlags[2]=atoi(pkvd->szValue);
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
else if (strcmp(pkvd->szKeyName,"team4_allies")==0 && pkvd->szValue!=NULL)
|
||||
{
|
||||
g_AlliesFlags[3]=atoi(pkvd->szValue);
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
}
|
||||
}
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@
|
||||
// #define FN_DispatchUse DispatchUse /* pfnUse() */
|
||||
// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */
|
||||
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
|
||||
// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
|
||||
#define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
|
||||
// #define FN_DispatchSave DispatchSave /* pfnSave() */
|
||||
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
|
||||
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
|
||||
|
Reference in New Issue
Block a user