mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
weapon logging support
This commit is contained in:
parent
a9c5228c31
commit
6d8f61c4e0
@ -92,7 +92,7 @@ enum {
|
||||
|
||||
struct weaponsVault {
|
||||
char* name;
|
||||
char fullName[32];
|
||||
char* logName;
|
||||
short int ammoSlot;
|
||||
bool melee;
|
||||
};
|
||||
|
@ -345,6 +345,14 @@ static cell AMX_NATIVE_CALL TFC_GetWpnName(AMX *amx, cell *params) {
|
||||
return MF_SetAmxString(amx,params[2],weaponData[iIndex].name,params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL TFC_GetWpnLogName(AMX *amx, cell *params) {
|
||||
int iIndex = params[1];
|
||||
if ( iIndex < 1 || iIndex > TFCMAX_WEAPONS ){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
return MF_SetAmxString(amx,params[2],weaponData[iIndex].logName,params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL TFC_SetPDdata(AMX *amx, cell *params) {
|
||||
|
||||
@ -392,6 +400,7 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
{"TFC_GetWeaponBAmmo", TFC_GetWeaponBAmmo},
|
||||
{"TFC_SetWeaponBAmmo", TFC_SetWeaponBAmmo},
|
||||
{"TFC_GetWpnName", TFC_GetWpnName},
|
||||
{"TFC_GetWpnLogName", TFC_GetWpnLogName},
|
||||
|
||||
{"TFC_IsMelee", TFC_IsMelee},
|
||||
{"TFC_UserKill" , TFC_UserKill},
|
||||
|
@ -84,35 +84,35 @@ knife,iSlot:-1,iId:23
|
||||
*/
|
||||
weaponsVault weaponData[] = {
|
||||
{ "", "", -1 }, // 0
|
||||
{ "timer", "", -1 }, // 1
|
||||
{ "sentrygun", "", -1 }, // 2
|
||||
{ "medikit", "", -1 , true},
|
||||
{ "spanner", "", 2 , true },
|
||||
{ "axe", "", -1 , true },
|
||||
{ "sniperrifle", "", 1 },
|
||||
{ "autorifle", "", 1 },
|
||||
{ "shotgun", "", 1 },
|
||||
{ "supershotgun", "", 1 },
|
||||
{ "ng", "", 3 },
|
||||
{ "superng", "", 3 },
|
||||
{ "gl", "", 4 },
|
||||
{ "timer", "infection", -1 }, // 1
|
||||
{ "sentrygun", "sentrygun", -1 }, // 2
|
||||
{ "medikit", "medikit", -1 , true},
|
||||
{ "spanner", "spanner", 2 , true },
|
||||
{ "axe", "axe", -1 , true },
|
||||
{ "sniperrifle", "sniperrifle", 1 },
|
||||
{ "autorifle", "autorifle", 1 },
|
||||
{ "shotgun", "shotgun", 1 },
|
||||
{ "supershotgun", "supershotgun", 1 },
|
||||
{ "ng", "nails", 3 },
|
||||
{ "superng", "supernails", 3 },
|
||||
{ "gl", "gl_grenade", 4 },
|
||||
{ "flamethrower", "", 2 },
|
||||
{ "rpg", "", 4 },
|
||||
{ "ic", "", 4 },
|
||||
{ "flames", "", -1 }, // 16
|
||||
{ "ac", "", 1 },
|
||||
{ "rpg", "rocket", 4 },
|
||||
{ "ic", "ic", 4 },
|
||||
{ "flames", "flames", -1 }, // 16
|
||||
{ "ac", "ac", 1 },
|
||||
{ "", "", -1 }, // 18
|
||||
{ "", "", -1 }, // 19
|
||||
{ "tranq", "", 1 },
|
||||
{ "railgun", "", 3 },
|
||||
{ "pl", "", 4 },
|
||||
{ "knife", "", -1 , true },
|
||||
{ "caltrop", "", -1 }, // 24
|
||||
{ "concussion", "", -1 },
|
||||
{ "grenade", "", -1 },
|
||||
{ "nailgrenade", "", -1 },
|
||||
{ "mirvgrenade", "", -1 },
|
||||
{ "napalm", "", -1 },
|
||||
{ "gas", "", -1 },
|
||||
{ "emp", "", -1 },
|
||||
{ "tranq", "tranq", 1 },
|
||||
{ "railgun", "railgun", 3 },
|
||||
{ "pl", "pipebomb", 4 },
|
||||
{ "knife", "knife", -1 , true },
|
||||
{ "caltrop", "caltrop", -1 }, // 24
|
||||
{ "concussion", "concussiongrenade", -1 },
|
||||
{ "grenade", "normalgrenade", -1 },
|
||||
{ "nailgrenade", "nailgrenade", -1 },
|
||||
{ "mirvgrenade", "mirvgrenade", -1 },
|
||||
{ "napalm", "napalmgrenade", -1 },
|
||||
{ "gas", "gasgrenade", -1 },
|
||||
{ "emp", "empgrenade", -1 },
|
||||
};
|
||||
|
@ -278,27 +278,31 @@ void SetModel_Post(edict_t *e, const char *m){
|
||||
}
|
||||
|
||||
void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr) {
|
||||
if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&&
|
||||
e&&(e->v.flags& (FL_CLIENT | FL_FAKECLIENT) )){
|
||||
GET_PLAYER_POINTER(e)->aiming = ptr->iHitgroup;
|
||||
if ( !e )
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
if ( e->v.owner && e->v.owner->v.flags& (FL_CLIENT | FL_FAKECLIENT) ){
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(e->v.owner);
|
||||
for ( int i=0;i<MAX_TRACE;i++){
|
||||
if ( strcmp( traceData[i].szName,STRING(e->v.classname)) == 0 ){
|
||||
if ( traceData[i].iAction & ACT_NADE_SHOT ){
|
||||
pPlayer->saveShot(traceData[i].iId);
|
||||
if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&&
|
||||
(e->v.flags& (FL_CLIENT | FL_FAKECLIENT) )){
|
||||
GET_PLAYER_POINTER(e)->aiming = ptr->iHitgroup;
|
||||
}
|
||||
else{
|
||||
if ( e->v.owner && e->v.owner->v.flags& (FL_CLIENT | FL_FAKECLIENT) ){
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(e->v.owner);
|
||||
|
||||
for ( int i=0;i<MAX_TRACE;i++){
|
||||
if ( strcmp( traceData[i].szName,STRING(e->v.classname)) == 0 ){
|
||||
|
||||
if ( traceData[i].iAction & ACT_NADE_SHOT ){
|
||||
pPlayer->saveShot(traceData[i].iId);
|
||||
}
|
||||
if ( traceData[i].iAction & ACT_NADE_PUT ){
|
||||
g_grenades.put(e,traceData[i].fDel,traceData[i].iId,GET_PLAYER_POINTER(e->v.owner));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ( traceData[i].iAction & ACT_NADE_PUT ){
|
||||
g_grenades.put(e,traceData[i].fDel,traceData[i].iId,GET_PLAYER_POINTER(e->v.owner));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,13 @@ void Client_Damage(void* mValue){
|
||||
|
||||
case 2:
|
||||
edict_t* enemy;
|
||||
if ( !mPlayer || !damage )
|
||||
break;
|
||||
|
||||
enemy = mPlayer->pEdict->v.dmg_inflictor;
|
||||
if ( !mPlayer || !damage || FNullEnt( enemy ) ) break;
|
||||
|
||||
if ( FNullEnt( enemy ) )
|
||||
break;
|
||||
|
||||
if (enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) { // attacker is player and his active weapon
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user