mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
- Added new forwards as well as new stocks
This commit is contained in:
parent
07e55f3b71
commit
84ec8ef007
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* DoDx
|
||||
* DoDx
|
||||
* Copyright (c) 2004 Lukasz Wlasinski
|
||||
*
|
||||
*
|
||||
@ -93,6 +93,14 @@ void CPlayer::Disconnect(){
|
||||
bot = false;
|
||||
savedScore = 0;
|
||||
|
||||
// Zors
|
||||
olddeadflag=0;
|
||||
oldteam=0;
|
||||
oldplayerclass=0;
|
||||
is_model_set=false;
|
||||
body_num=0;
|
||||
position = 0;
|
||||
|
||||
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
|
||||
return;
|
||||
|
||||
@ -108,18 +116,18 @@ void CPlayer::PutInServer(){
|
||||
return;
|
||||
|
||||
restartStats();
|
||||
|
||||
|
||||
const char* unique;
|
||||
const char* name = STRING(pEdict->v.netname);
|
||||
switch((int)dodstats_rank->value) {
|
||||
case 1:
|
||||
case 1:
|
||||
if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 )
|
||||
unique = name; // failed to get authid
|
||||
break;
|
||||
case 2:
|
||||
unique = ip;
|
||||
case 2:
|
||||
unique = ip;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
unique = name;
|
||||
}
|
||||
if ( ( rank = g_rank.findEntryInRank( unique , name ) ) == 0 )
|
||||
@ -153,6 +161,14 @@ void CPlayer::Init( int pi, edict_t* pe )
|
||||
ingame = false;
|
||||
bot = false;
|
||||
savedScore = 0;
|
||||
|
||||
// Zors
|
||||
olddeadflag=0;
|
||||
oldteam=0;
|
||||
oldplayerclass=0;
|
||||
is_model_set=false;
|
||||
body_num=0;
|
||||
position = 0;
|
||||
}
|
||||
|
||||
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
|
||||
@ -182,13 +198,13 @@ void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
|
||||
pVictim->weapons[0].deaths++;
|
||||
pVictim->life.deaths++;
|
||||
pVictim->round.deaths++;
|
||||
|
||||
|
||||
|
||||
|
||||
pVictim->weaponsLife[vw].deaths++; // DEC-Weapon (life) stats
|
||||
pVictim->weaponsLife[0].deaths++; // DEC-Weapon (life) stats
|
||||
pVictim->weaponsRnd[vw].deaths++; // DEC-Weapon (round) stats
|
||||
pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats
|
||||
|
||||
|
||||
int vi = pVictim->index;
|
||||
victims[vi].name = (char*)weaponData[wweapon].name;
|
||||
victims[vi].deaths++;
|
||||
@ -197,8 +213,8 @@ void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
|
||||
victims[0].deaths++;
|
||||
victims[0].hs += hhs;
|
||||
victims[0].tks += ttk;
|
||||
|
||||
|
||||
|
||||
|
||||
weaponsLife[wweapon].kills++; // DEC-Weapon (life) stats
|
||||
weaponsLife[wweapon].hs += hhs; // DEC-Weapon (life) stats
|
||||
weaponsLife[wweapon].tks += ttk; // DEC-Weapon (life) stats
|
||||
@ -212,7 +228,7 @@ void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
|
||||
weaponsRnd[0].kills++; // DEC-Weapon (round) stats
|
||||
weaponsRnd[0].hs += hhs; // DEC-Weapon (round) stats
|
||||
weaponsRnd[0].tks += ttk; // DEC-Weapon (round) stats
|
||||
|
||||
|
||||
weapons[wweapon].kills++;
|
||||
weapons[wweapon].hs += hhs;
|
||||
weapons[wweapon].tks += ttk;
|
||||
@ -317,11 +333,67 @@ void CPlayer::killPlayer(){
|
||||
pEdict->v.weapons = 0;
|
||||
}
|
||||
|
||||
void CPlayer::initModel(char* model)
|
||||
{
|
||||
newmodel = model;
|
||||
is_model_set = true;
|
||||
}
|
||||
|
||||
void CPlayer::clearModel()
|
||||
{
|
||||
is_model_set = false;
|
||||
}
|
||||
|
||||
bool CPlayer::setModel()
|
||||
{
|
||||
if(!ingame || ignoreBots(pEdict))
|
||||
return false;
|
||||
|
||||
if(is_model_set)
|
||||
{
|
||||
ENTITY_SET_KEYVALUE(pEdict, "model", newmodel);
|
||||
pEdict->v.body = body_num;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CPlayer::setBody(int bn)
|
||||
{
|
||||
if(!ingame || ignoreBots(pEdict))
|
||||
return;
|
||||
|
||||
body_num = bn;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void CPlayer::checkStatus()
|
||||
{
|
||||
if(!ingame || ignoreBots(pEdict))
|
||||
return;
|
||||
|
||||
if(olddeadflag != 0 && pEdict->v.deadflag == 0 && iFSpawnForward != -1)
|
||||
MF_ExecuteForward(iFSpawnForward, index);
|
||||
|
||||
if(oldteam != pEdict->v.team && iFTeamForward != -1)
|
||||
MF_ExecuteForward(iFTeamForward, index, pEdict->v.team, oldteam);
|
||||
|
||||
if(oldplayerclass != pEdict->v.playerclass)
|
||||
MF_ExecuteForward(iFClassForward, index, pEdict->v.playerclass, oldplayerclass);
|
||||
|
||||
olddeadflag = pEdict->v.deadflag;
|
||||
oldteam = pEdict->v.team;
|
||||
oldplayerclass = pEdict->v.playerclass;
|
||||
}
|
||||
|
||||
// *****************************************************
|
||||
// class CMapInfo
|
||||
// *****************************************************
|
||||
|
||||
void CMapInfo::Init(){
|
||||
void CMapInfo::Init()
|
||||
{
|
||||
pEdict = 0;
|
||||
initialized = false;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* DoDX
|
||||
* DoDX
|
||||
* Copyright (c) 2004 Lukasz Wlasinski
|
||||
*
|
||||
*
|
||||
@ -110,6 +110,24 @@ public:
|
||||
void restartStats(bool all = true);
|
||||
void killPlayer();
|
||||
|
||||
// Zors
|
||||
int oldteam;
|
||||
int olddeadflag;
|
||||
int oldplayerclass;
|
||||
|
||||
bool is_model_set;
|
||||
char* newmodel;
|
||||
int body_num;
|
||||
|
||||
int position;
|
||||
|
||||
void initModel(char*);
|
||||
void clearModel();
|
||||
bool setModel();
|
||||
void setBody(int);
|
||||
void checkStatus();
|
||||
// Zors
|
||||
|
||||
inline bool IsBot(){
|
||||
const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
|
||||
return ( auth && !strcmp( auth , "BOT" ) );
|
||||
@ -125,7 +143,7 @@ public:
|
||||
|
||||
class Grenades
|
||||
{
|
||||
struct Obj
|
||||
struct Obj
|
||||
{
|
||||
CPlayer* player;
|
||||
edict_t* grenade;
|
||||
|
@ -343,7 +343,50 @@ static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params){ // player,wid
|
||||
MF_SetAmxString(amx,params[2],szTeam,params[3]);
|
||||
}
|
||||
return iTeam;
|
||||
}
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL dod_set_model(AMX *amx, cell *params) // player,model
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_PLAYER(index);
|
||||
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
if(!pPlayer->ingame)
|
||||
return false;
|
||||
|
||||
int length;
|
||||
pPlayer->initModel((char*)STRING(ALLOC_STRING(MF_GetAmxString(amx, params[2], 1, &length))));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL dod_set_body(AMX *amx, cell *params) // player,bodynumber
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_PLAYER(index);
|
||||
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
if(!pPlayer->ingame)
|
||||
return false;
|
||||
|
||||
pPlayer->setBody(params[2]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL dod_clear_model(AMX *amx, cell *params) // player
|
||||
{
|
||||
int index = params[1];
|
||||
CHECK_PLAYER(index);
|
||||
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
if(!pPlayer->ingame)
|
||||
return false;
|
||||
|
||||
pPlayer->clearModel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO base_Natives[] = {
|
||||
|
||||
@ -383,6 +426,11 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
{ "dod_get_wpnlogname", get_weapon_logname },
|
||||
{ "dod_is_melee", is_melee },
|
||||
|
||||
// Zors
|
||||
{"dod_set_model", dod_set_model},
|
||||
{"dod_set_body_number", dod_set_body},
|
||||
{"dod_clear_model", dod_clear_model},
|
||||
|
||||
///*******************
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* DoDX
|
||||
* DoDX
|
||||
* Copyright (c) 2004 Lukasz Wlasinski
|
||||
*
|
||||
*
|
||||
@ -40,7 +40,7 @@
|
||||
#define GET_PLAYER_POINTER_I(i) (&players[i])
|
||||
|
||||
#ifndef GETPLAYERAUTHID
|
||||
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
|
||||
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
|
||||
#endif
|
||||
|
||||
extern AMX_NATIVE_INFO stats_Natives[];
|
||||
@ -68,19 +68,34 @@ void Client_RoundState(void*);
|
||||
void Client_AmmoX(void*);
|
||||
void Client_AmmoShort(void*);
|
||||
|
||||
// Zors
|
||||
//void WeaponList(void*);
|
||||
//void WeaponList_End(void*);
|
||||
|
||||
typedef void (*funEventCall)(void*);
|
||||
|
||||
extern int AlliesScore;
|
||||
extern int AxisScore;
|
||||
|
||||
extern int gmsgCurWeapon;
|
||||
extern int gmsgHealth;
|
||||
extern int gmsgResetHUD;
|
||||
extern int gmsgObjScore;
|
||||
extern int gmsgRoundState;
|
||||
extern int gmsgTeamScore;
|
||||
extern int gmsgScoreShort;
|
||||
extern int gmsgPTeam;
|
||||
|
||||
extern int gmsgAmmoX;
|
||||
extern int gmsgAmmoShort;
|
||||
|
||||
extern int iFDamage;
|
||||
extern int iFDeath;
|
||||
extern int iFScore;
|
||||
|
||||
// Zors
|
||||
extern int iFSpawnForward;
|
||||
extern int iFTeamForward;
|
||||
extern int iFClassForward;
|
||||
|
||||
extern cvar_t* dodstats_maxsize;
|
||||
extern cvar_t* dodstats_rank;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* DoDX
|
||||
* DoDX
|
||||
* Copyright (c) 2004 Lukasz Wlasinski
|
||||
*
|
||||
*
|
||||
@ -47,27 +47,33 @@ int mPlayerIndex;
|
||||
int AlliesScore;
|
||||
int AxisScore;
|
||||
|
||||
int iFDamage;
|
||||
int iFDeath;
|
||||
int iFScore;
|
||||
int iFDamage = -1;
|
||||
int iFDeath = -1;
|
||||
int iFScore = -1;
|
||||
|
||||
// Zors
|
||||
int iFSpawnForward = -1;
|
||||
int iFTeamForward = -1;
|
||||
int iFClassForward = -1;
|
||||
|
||||
int gmsgCurWeapon;
|
||||
int gmsgHealth;
|
||||
int gmsgResetHUD;
|
||||
int gmsgObjScore;
|
||||
int gmsgRoundState;
|
||||
|
||||
int gmsgTeamScore;
|
||||
int gmsgScoreShort;
|
||||
int gmsgPTeam;
|
||||
|
||||
int gmsgAmmoX;
|
||||
int gmsgAmmoShort;
|
||||
|
||||
// Zors
|
||||
//int gmsgWeaponList;
|
||||
//int gmsgWeaponList_End;
|
||||
|
||||
RankSystem g_rank;
|
||||
Grenades g_grenades;
|
||||
|
||||
|
||||
cvar_t init_dodstats_maxsize ={"dodstats_maxsize","3500", 0 , 3500.0 };
|
||||
cvar_t init_dodstats_reset ={"dodstats_reset","0"};
|
||||
cvar_t init_dodstats_rank ={"dodstats_rank","0"};
|
||||
@ -90,13 +96,16 @@ struct sUserMsg {
|
||||
{ "RoundState",&gmsgRoundState,Client_RoundState,false },
|
||||
{ "Health",&gmsgHealth,Client_Health_End,true },
|
||||
{ "ResetHUD",&gmsgResetHUD,Client_ResetHUD_End,true },
|
||||
|
||||
{ "TeamScore",&gmsgTeamScore,Client_TeamScore,false },
|
||||
{ "ScoreShort",&gmsgScoreShort,NULL,false },
|
||||
{ "PTeam",&gmsgPTeam,NULL,false },
|
||||
|
||||
{ "AmmoX",&gmsgAmmoX,Client_AmmoX,false},
|
||||
{ "AmmoShort",&gmsgAmmoShort,Client_AmmoShort,false},
|
||||
{ "ScoreShort",&gmsgScoreShort,NULL,false },
|
||||
|
||||
//Zors
|
||||
//{ "WeaponList",&gmsgWeaponList,WeaponList,true },
|
||||
//{ "WeaponList",&gmsgWeaponList_End,WeaponList_End,true },
|
||||
|
||||
{ 0,0,0,false }
|
||||
};
|
||||
@ -115,7 +124,7 @@ int RegUserMsg_Post(const char *pszName, int iSize){
|
||||
int id = META_RESULT_ORIG_RET( int );
|
||||
|
||||
*g_user_msg[ i ].id = id;
|
||||
|
||||
|
||||
if ( g_user_msg[ i ].endmsg )
|
||||
modMsgsEnd[ id ] = g_user_msg[ i ].func;
|
||||
else
|
||||
@ -129,7 +138,7 @@ int RegUserMsg_Post(const char *pszName, int iSize){
|
||||
}
|
||||
|
||||
void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||
|
||||
|
||||
rankBots = (int)dodstats_rankbots->value ? true:false;
|
||||
|
||||
for( int i = 1; i <= gpGlobals->maxClients; ++i )
|
||||
@ -140,13 +149,16 @@ void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||
}
|
||||
|
||||
void PlayerPreThink_Post( edict_t *pEntity ) {
|
||||
if ( !isModuleActive() )
|
||||
if ( !isModuleActive() )
|
||||
RETURN_META(MRES_IGNORED);
|
||||
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||
if ( !pPlayer->ingame )
|
||||
RETURN_META(MRES_IGNORED);
|
||||
|
||||
// Zors
|
||||
pPlayer->checkStatus();
|
||||
|
||||
if (pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time){
|
||||
if ( !ignoreBots(pEntity) ){
|
||||
pPlayer->clearStats = 0.0f;
|
||||
@ -165,7 +177,7 @@ void PlayerPreThink_Post( edict_t *pEntity ) {
|
||||
pPlayer->sendScore = 0.0f;
|
||||
MF_ExecuteForward( iFScore,pPlayer->index, pPlayer->lastScore, pPlayer->savedScore );
|
||||
}
|
||||
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
@ -180,7 +192,7 @@ void ServerDeactivate() {
|
||||
CVAR_SET_FLOAT("dodstats_reset",0.0);
|
||||
g_rank.clear();
|
||||
}
|
||||
|
||||
|
||||
g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("dodstats") ) );
|
||||
|
||||
// clear custom weapons info
|
||||
@ -323,7 +335,8 @@ void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void DispatchKeyValue_Post( edict_t *pentKeyvalue, KeyValueData *pkvd ){
|
||||
void DispatchKeyValue_Post( edict_t *pentKeyvalue, KeyValueData *pkvd )
|
||||
{
|
||||
|
||||
if ( !pkvd->szClassName ){
|
||||
// info_doddetect
|
||||
@ -338,22 +351,48 @@ void DispatchKeyValue_Post( edict_t *pentKeyvalue, KeyValueData *pkvd ){
|
||||
if ( pkvd->szKeyName[0]=='d' && pkvd->szKeyName[7]=='a' ){
|
||||
if ( pkvd->szKeyName[8]=='l' ){
|
||||
switch ( pkvd->szKeyName[14] ){
|
||||
case 'c':
|
||||
g_map.detect_allies_country=atoi(pkvd->szValue);
|
||||
case 'c':
|
||||
g_map.detect_allies_country=atoi(pkvd->szValue);
|
||||
break;
|
||||
case 'p':
|
||||
g_map.detect_allies_paras=atoi(pkvd->szValue);
|
||||
case 'p':
|
||||
g_map.detect_allies_paras=atoi(pkvd->szValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( pkvd->szKeyName[12]=='p' ) g_map.detect_axis_paras=atoi(pkvd->szValue);
|
||||
}
|
||||
else if ( pkvd->szKeyName[12]=='p' ) g_map.detect_axis_paras=atoi(pkvd->szValue);
|
||||
}
|
||||
}
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void OnMetaAttach() {
|
||||
|
||||
void SetClientKeyValue(int id, char *protocol, char *type, char *var)
|
||||
{
|
||||
// ID: Number
|
||||
// protocol: \name\Sgt.MEOW\topcolor\1\bottomcolor\1\cl_lw\1\team\axis\model\axis-inf
|
||||
// type: model
|
||||
// var: axis-inf
|
||||
|
||||
// Check to see if its a player and we are setting a model
|
||||
if(strcmp(type, "model") == 0 &&
|
||||
(strcmp(var, "axis-inf") == 0 ||
|
||||
strcmp(var, "axis-para") == 0 ||
|
||||
strcmp(var, "us-inf") == 0 ||
|
||||
strcmp(var, "us-para") == 0 ||
|
||||
strcmp(var, "brit-inf") == 0))
|
||||
{
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||
if(!pPlayer->ingame)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
|
||||
if(pPlayer->setModel())
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void OnMetaAttach()
|
||||
{
|
||||
CVAR_REGISTER (&init_dodstats_maxsize);
|
||||
CVAR_REGISTER (&init_dodstats_reset);
|
||||
CVAR_REGISTER (&init_dodstats_rank);
|
||||
@ -366,34 +405,45 @@ void OnMetaAttach() {
|
||||
dodstats_pause = CVAR_GET_POINTER(init_dodstats_pause.name);
|
||||
}
|
||||
|
||||
void OnAmxxAttach() {
|
||||
void OnAmxxAttach()
|
||||
{
|
||||
|
||||
MF_AddNatives( stats_Natives );
|
||||
MF_AddNatives( base_Natives );
|
||||
|
||||
const char* path = get_localinfo("dodstats_score","addons/amxmodx/data/dodstats.amxx");
|
||||
if ( path && *path ) {
|
||||
|
||||
if ( path && *path )
|
||||
{
|
||||
char error[128];
|
||||
g_rank.loadCalc( MF_BuildPathname("%s",path) , error );
|
||||
}
|
||||
|
||||
if ( !g_rank.begin() ){
|
||||
|
||||
if ( !g_rank.begin() )
|
||||
{
|
||||
g_rank.loadRank( MF_BuildPathname("%s",
|
||||
get_localinfo("dodstats","addons/amxmodx/data/dodstats.dat") ) );
|
||||
get_localinfo("dodstats","addons/amxmodx/data/dodstats.dat") ) );
|
||||
}
|
||||
|
||||
g_map.Init();
|
||||
}
|
||||
|
||||
void OnAmxxDetach() {
|
||||
void OnAmxxDetach()
|
||||
{
|
||||
g_rank.clear();
|
||||
g_grenades.clear();
|
||||
g_rank.unloadCalc();
|
||||
}
|
||||
|
||||
void OnPluginsLoaded(){
|
||||
void OnPluginsLoaded()
|
||||
{
|
||||
iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||
iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||
iFScore = MF_RegisterForward("client_score",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||
|
||||
// Zors
|
||||
iFTeamForward = MF_RegisterForward("dod_client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*team*/,FP_CELL/*oldteam*/,FP_DONE);
|
||||
iFSpawnForward = MF_RegisterForward("dod_client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
|
||||
iFClassForward = MF_RegisterForward("dod_client_changeclass",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*class*/,FP_CELL/*oldclass*/,FP_DONE);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@
|
||||
// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer
|
||||
// #define FN_InfoKeyValue InfoKeyValue
|
||||
// #define FN_SetKeyValue SetKeyValue
|
||||
// #define FN_SetClientKeyValue SetClientKeyValue
|
||||
#define FN_SetClientKeyValue SetClientKeyValue
|
||||
// #define FN_IsMapValid IsMapValid
|
||||
// #define FN_StaticDecal StaticDecal
|
||||
// #define FN_PrecacheGeneric PrecacheGeneric
|
||||
|
@ -31,31 +31,40 @@
|
||||
#include "amxxmodule.h"
|
||||
#include "dodx.h"
|
||||
|
||||
void Client_ResetHUD_End(void* mValue){
|
||||
void Client_ResetHUD_End(void* mValue)
|
||||
{
|
||||
mPlayer->clearStats = gpGlobals->time + 0.25f;
|
||||
}
|
||||
|
||||
void Client_RoundState(void* mValue){
|
||||
void Client_RoundState(void* mValue)
|
||||
{
|
||||
if ( mPlayer ) return;
|
||||
int result = *(int*)mValue;
|
||||
if ( result == 1 ){
|
||||
for (int i=1;i<=gpGlobals->maxClients;i++){
|
||||
if ( result == 1 )
|
||||
{
|
||||
for (int i=1;i<=gpGlobals->maxClients;i++)
|
||||
{
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
||||
if (pPlayer->ingame) {
|
||||
if (pPlayer->ingame)
|
||||
{
|
||||
pPlayer->clearRound = gpGlobals->time + 0.25f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client_TeamScore(void* mValue){
|
||||
void Client_TeamScore(void* mValue)
|
||||
{
|
||||
static int index;
|
||||
switch(mState++){
|
||||
|
||||
switch(mState++)
|
||||
{
|
||||
case 0:
|
||||
index = *(int*)mValue;
|
||||
break;
|
||||
case 1:
|
||||
switch (index){
|
||||
switch (index)
|
||||
{
|
||||
case 1:
|
||||
AlliesScore = *(int*)mValue;
|
||||
break;
|
||||
@ -67,16 +76,20 @@ void Client_TeamScore(void* mValue){
|
||||
}
|
||||
}
|
||||
|
||||
void Client_ObjScore(void* mValue){
|
||||
void Client_ObjScore(void* mValue)
|
||||
{
|
||||
static CPlayer *pPlayer;
|
||||
static int score;
|
||||
switch(mState++){
|
||||
|
||||
switch(mState++)
|
||||
{
|
||||
case 0:
|
||||
pPlayer = GET_PLAYER_POINTER_I(*(int*)mValue);
|
||||
break;
|
||||
case 1:
|
||||
score = *(int*)mValue;
|
||||
if ( (pPlayer->lastScore = score - pPlayer->savedScore) && isModuleActive() ){
|
||||
if ( (pPlayer->lastScore = score - pPlayer->savedScore) && isModuleActive() )
|
||||
{
|
||||
pPlayer->updateScore(pPlayer->current,pPlayer->lastScore);
|
||||
pPlayer->sendScore = gpGlobals->time + 0.25f;
|
||||
}
|
||||
@ -86,10 +99,13 @@ void Client_ObjScore(void* mValue){
|
||||
}
|
||||
|
||||
|
||||
void Client_CurWeapon(void* mValue){
|
||||
void Client_CurWeapon(void* mValue)
|
||||
{
|
||||
static int iState;
|
||||
static int iId;
|
||||
switch (mState++){
|
||||
|
||||
switch (mState++)
|
||||
{
|
||||
case 0:
|
||||
iState = *(int*)mValue;
|
||||
break;
|
||||
@ -103,17 +119,20 @@ void Client_CurWeapon(void* mValue){
|
||||
int iClip = *(int*)mValue;
|
||||
mPlayer->current = iId;
|
||||
|
||||
if ( weaponData[iId].needcheck ){
|
||||
if ( weaponData[iId].needcheck )
|
||||
{
|
||||
iId = get_weaponid(mPlayer);
|
||||
mPlayer->current = iId;
|
||||
}
|
||||
|
||||
if (iClip > -1) {
|
||||
if ( mPlayer->current == 17 ){
|
||||
if ( mPlayer->current == 17 )
|
||||
{
|
||||
if ( iClip+2 == mPlayer->weapons[iId].clip)
|
||||
mPlayer->saveShot(iId);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if ( iClip+1 == mPlayer->weapons[iId].clip)
|
||||
mPlayer->saveShot(iId);
|
||||
}
|
||||
@ -140,16 +159,19 @@ void Client_Health_End(void* mValue){
|
||||
int aim = 0;
|
||||
|
||||
mPlayer->pEdict->v.dmg_take = 0.0;
|
||||
|
||||
|
||||
CPlayer* pAttacker = NULL;
|
||||
|
||||
if ( enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ){
|
||||
if ( enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) )
|
||||
{
|
||||
pAttacker = GET_PLAYER_POINTER(enemy);
|
||||
weapon = pAttacker->current;
|
||||
|
||||
if ( weaponData[weapon].needcheck )
|
||||
weapon = get_weaponid(pAttacker);
|
||||
|
||||
aim = pAttacker->aiming;
|
||||
|
||||
if ( weaponData[weapon].melee )
|
||||
pAttacker->saveShot(weapon);
|
||||
}
|
||||
@ -158,49 +180,125 @@ void Client_Health_End(void* mValue){
|
||||
|
||||
int TA = 0;
|
||||
|
||||
if ( !pAttacker ){
|
||||
if ( !pAttacker )
|
||||
{
|
||||
pAttacker = mPlayer;
|
||||
}
|
||||
|
||||
if ( pAttacker->index != mPlayer->index ){
|
||||
if ( pAttacker->index != mPlayer->index )
|
||||
{
|
||||
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||
|
||||
if ( mPlayer->pEdict->v.team == pAttacker->pEdict->v.team )
|
||||
TA = 1;
|
||||
}
|
||||
|
||||
MF_ExecuteForward( iFDamage,pAttacker->index, mPlayer->index, damage, weapon, aim, TA );
|
||||
MF_ExecuteForward( iFDamage, pAttacker->index, mPlayer->index, damage, weapon, aim, TA );
|
||||
|
||||
if ( !mPlayer->IsAlive() ){
|
||||
if ( !mPlayer->IsAlive() )
|
||||
{
|
||||
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA);
|
||||
|
||||
MF_ExecuteForward( iFDeath,pAttacker->index, mPlayer->index, weapon, aim, TA );
|
||||
MF_ExecuteForward( iFDeath, pAttacker->index, mPlayer->index, weapon, aim, TA );
|
||||
}
|
||||
}
|
||||
|
||||
void Client_AmmoX(void* mValue){
|
||||
void Client_AmmoX(void* mValue)
|
||||
{
|
||||
static int iAmmo;
|
||||
switch (mState++){
|
||||
|
||||
switch (mState++)
|
||||
{
|
||||
case 0:
|
||||
iAmmo = *(int*)mValue;
|
||||
break;
|
||||
case 1:
|
||||
if (!mPlayer ) break;
|
||||
for(int i = 1; i < MAX_WEAPONS ; ++i)
|
||||
if (!mPlayer )
|
||||
break;
|
||||
for(int i = 1; i < MAX_WEAPONS ; ++i)
|
||||
{
|
||||
if (iAmmo == weaponData[i].ammoSlot)
|
||||
mPlayer->weapons[i].ammo = *(int*)mValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client_AmmoShort(void* mValue){
|
||||
void Client_AmmoShort(void* mValue)
|
||||
{
|
||||
static int iAmmo;
|
||||
switch (mState++){
|
||||
|
||||
switch (mState++)
|
||||
{
|
||||
case 0:
|
||||
iAmmo = *(int*)mValue;
|
||||
break;
|
||||
case 1:
|
||||
if (!mPlayer ) break;
|
||||
for(int i = 1; i < MAX_WEAPONS ; ++i)
|
||||
{
|
||||
if (iAmmo == weaponData[i].ammoSlot)
|
||||
mPlayer->weapons[i].ammo = *(int*)mValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Working on being able to modify and switch weapons as they are sent to the client
|
||||
|
||||
void WeaponList(void* value)
|
||||
{
|
||||
if(!mPlayer)
|
||||
return;
|
||||
|
||||
if(!mPlayer->ingame || ignoreBots(mPlayer->pEdict))
|
||||
return;
|
||||
|
||||
switch(mPlayer->position)
|
||||
{
|
||||
case 0: MF_Log("pszName = %s", value); break; // string weapon name
|
||||
case 1: MF_Log("pszAmmo1 = %d", (int)value); break; // byte Ammo Type
|
||||
case 2: MF_Log("iMaxAmmo1 = %d", (int)value); break; // byte Max Ammo 1
|
||||
case 3: MF_Log("pszAmmo2 = %d", (int)value); break; // byte Ammo2 Type
|
||||
case 4: MF_Log("iMaxAmmo2 = %d", (int)value); break; // byte Max Ammo 2
|
||||
case 5: MF_Log("iSlot = %d", (int)value); break; // byte bucket
|
||||
case 6: MF_Log("iPosition = %d", (int)value); break; // byte bucket pos
|
||||
case 7: MF_Log("iId = %d", (int)value); break; // byte id (bit index into pev->weapons)
|
||||
case 8: MF_Log("iFlags = %d", (int)value); break; // byte Flags
|
||||
};
|
||||
|
||||
mPlayer->position++;
|
||||
}
|
||||
|
||||
void WeaponList_End(void* mValue)
|
||||
{
|
||||
if(!mPlayer)
|
||||
return;
|
||||
|
||||
MF_Log("Done with %d", mPlayer->position);
|
||||
mPlayer->position = 0;
|
||||
}
|
||||
|
||||
struct weapon_info_s
|
||||
{
|
||||
char *pszName; // string weapon name
|
||||
int pszAmmo1; // byte Ammo Type
|
||||
int iMaxAmmo1; // byte Max Ammo 1
|
||||
int pszAmmo2; // byte Ammo2 Type
|
||||
int iMaxAmmo2; // byte Max Ammo 2
|
||||
int iSlot; // byte bucket
|
||||
int iPosition; // byte bucket pos
|
||||
int iId; // byte id (bit index into pev->weapons)
|
||||
int iFlags; // byte Flags
|
||||
}weapon_info_t;
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeaponList, NULL, pev );
|
||||
WRITE_STRING(pszName); // string weapon name
|
||||
WRITE_BYTE(GetAmmoIndex(II.pszAmmo1)); // byte Ammo Type
|
||||
WRITE_BYTE(II.iMaxAmmo1); // byte Max Ammo 1
|
||||
WRITE_BYTE(GetAmmoIndex(II.pszAmmo2)); // byte Ammo2 Type
|
||||
WRITE_BYTE(II.iMaxAmmo2); // byte Max Ammo 2
|
||||
WRITE_BYTE(II.iSlot); // byte bucket
|
||||
WRITE_BYTE(II.iPosition); // byte bucket pos
|
||||
WRITE_BYTE(II.iId); // byte id (bit index into pev->weapons)
|
||||
WRITE_BYTE(II.iFlags); // byte Flags
|
||||
MESSAGE_END();
|
||||
*/
|
||||
|
@ -31,35 +31,55 @@ enum {
|
||||
}
|
||||
|
||||
/* Use this function to register forwards */
|
||||
native register_statsfwd( ftype );
|
||||
native register_statsfwd(ftype);
|
||||
|
||||
/* Function is called after player to player attacks ,
|
||||
* if players were damaged by teammate TA is set to 1 */
|
||||
forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA);
|
||||
forward client_damage(attacker, victim, damage, wpnindex, hitplace, TA);
|
||||
|
||||
/* Function is called after player death ,
|
||||
* if player was killed by teammate TK is set to 1 */
|
||||
forward client_death(killer,victim,wpnindex,hitplace,TK);
|
||||
forward client_death(killer, victim, wpnindex, hitplace, TK);
|
||||
|
||||
/* Function is called if player scored */
|
||||
forward client_score(index,score,total);
|
||||
forward client_score(id, score, total);
|
||||
|
||||
/* This Forward is called when a player changes team */
|
||||
forward dod_client_changeteam(id, team, oldteam);
|
||||
|
||||
/* This Forward is called if a player changes class, but just after spawn */
|
||||
forward dod_client_changeclass(id, class, oldclass);
|
||||
|
||||
/* This Forward is called when a player spawns */
|
||||
forward dod_client_spawn(id);
|
||||
|
||||
/* Sets the model for a player */
|
||||
native dod_set_model(id, model[]);
|
||||
|
||||
/* Sets the model for a player */
|
||||
native dod_set_body_number(id, bodynumber);
|
||||
|
||||
/* Un-Sets the model for a player */
|
||||
native dod_clear_model(id);
|
||||
|
||||
/* Custom Weapon Support */
|
||||
/* function will return index of new weapon */
|
||||
native custom_weapon_add( wpnname[],melee = 0,logname[]="" );
|
||||
native custom_weapon_add( wpnname[], melee = 0, logname[]="" );
|
||||
|
||||
/* Function will pass damage done by this custom weapon to stats module and other plugins */
|
||||
native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 );
|
||||
|
||||
/* Function will pass info about custom weapon shot to stats module */
|
||||
native custom_weapon_shot( weapon,index ); // weapon id , player id
|
||||
native custom_weapon_shot( weapon, index ); // weapon id , player id
|
||||
|
||||
/* function will return 1 if true */
|
||||
native xmod_is_melee_wpn(wpnindex);
|
||||
|
||||
/* Returns weapon name. */
|
||||
native xmod_get_wpnname(wpnindex,name[],len);
|
||||
native xmod_get_wpnname(wpnindex, name[], len);
|
||||
|
||||
/* Returns weapon logname. */
|
||||
native xmod_get_wpnlogname(wpnindex,name[],len);
|
||||
native xmod_get_wpnlogname(wpnindex, name[], len);
|
||||
|
||||
/* Returns weapons array size */
|
||||
native xmod_get_maxweapons();
|
||||
|
Loading…
Reference in New Issue
Block a user