- Added new forwards as well as new stocks
This commit is contained in:
parent
07e55f3b71
commit
84ec8ef007
|
@ -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;
|
||||
|
||||
|
@ -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){
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -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" ) );
|
||||
|
|
|
@ -345,6 +345,49 @@ static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params){ // player,wid
|
|||
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[] = {
|
||||
|
||||
{ "dod_wpnlog_to_name", wpnlog_to_name },
|
||||
|
@ -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 }
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 }
|
||||
};
|
||||
|
@ -147,6 +156,9 @@ void PlayerPreThink_Post( edict_t *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;
|
||||
|
@ -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
|
||||
|
@ -352,8 +365,34 @@ void DispatchKeyValue_Post( edict_t *pentKeyvalue, KeyValueData *pkvd ){
|
|||
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,18 +405,22 @@ 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") ) );
|
||||
}
|
||||
|
@ -385,15 +428,22 @@ void OnAmxxAttach() {
|
|||
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);
|
||||
}
|
||||
|
@ -141,15 +160,18 @@ void Client_Health_End(void* mValue){
|
|||
|
||||
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 );
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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();
|
||||
*/
|
||||
|
|
|
@ -42,13 +42,33 @@ forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA);
|
|||
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[]="" );
|
||||
|
||||
/* 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user