many changes , bomb countdown fix, custom_weapon_add fix, bomb damage support in death,damage forwards, added gasnades plugin with custom weapon support so gas damage/kills will be detected by csstats.

This commit is contained in:
Lukasz Wlasinksi
2004-09-19 09:51:05 +00:00
parent 1c6636b106
commit 04b88c16a9
8 changed files with 285 additions and 66 deletions

View File

@ -8,9 +8,10 @@
#define MAX_CWEAPONS 6
#define CSW_HEGRENADE 4
#define CSW_SMOKEGRENADE 9
#define CSW_FLASHBANG 25
#define CSW_HEGRENADE 4
#define CSW_C4 6
#define CSW_SMOKEGRENADE 9
#define CSW_FLASHBANG 25
// *****************************************************
// class CPlayer

View File

@ -287,8 +287,8 @@ void SetModel_Post(edict_t *e, const char *m){
switch(m[9]){
case 'h':
w_id = CSW_HEGRENADE;
g_grenades.put(e, 1.75, 4, pPlayer);
pPlayer->saveShot(4);
g_grenades.put(e, 2.0, 4, pPlayer);
pPlayer->saveShot(CSW_HEGRENADE);
break;
case 'f':
if (m[10]=='l') w_id = CSW_FLASHBANG;

View File

@ -273,36 +273,30 @@ static cell AMX_NATIVE_CALL get_statsnum(AMX *amx, cell *params)
return g_rank.getRankNum();
}
static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0
int i;
bool bFree = false;
static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,melee=0,logname
int i,iLen;
for ( i=MAX_WEAPONS;i<MAX_WEAPONS+MAX_CWEAPONS;i++){
if ( !weaponData[i].ammoSlot ){
bFree = true;
break;
if ( !weaponData[i].used ){
char* szName = MF_GetAmxString(amx, params[1], 0, &iLen);
char *szLog = MF_GetAmxString(amx, params[3], 0, &iLen);
strcpy(weaponData[i].name,szName);
strcpy(weaponData[i].logname,szLog);
weaponData[i].used = true;
weaponData[i].melee = params[2] ? true:false;
return i;
}
}
if ( !bFree ){
MF_PrintSrvConsole("No More Custom Weapon Slots!\n");
return 0;
}
int iLen;
char *szName = MF_GetAmxString(amx, params[1], 0, &iLen);
char *szLogName = MF_GetAmxString(amx, params[3], 0, &iLen);
strcpy(weaponData[i].name,szName);
strcpy(weaponData[i].logname,szLogName);
weaponData[i].ammoSlot = 1;
weaponData[i].melee = params[2] ? true:false;
return i;
MF_PrintSrvConsole("No More Custom Weapon Slots!\n");
return 0;
}
static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
int weapon = params[1];
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].ammoSlot ){ // only for custom weapons
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){ // only for custom weapons
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
return 0;
@ -361,7 +355,7 @@ static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,w
}
int weapon = params[1];
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].ammoSlot ){
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
return 0;
@ -375,7 +369,7 @@ static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,w
static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){
int id = params[1];
if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
return 0;
@ -385,7 +379,7 @@ static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){
int id = params[1];
if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
return 0;
@ -395,7 +389,7 @@ static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
int id = params[1];
if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
return 0;

View File

@ -14,9 +14,10 @@
extern AMX_NATIVE_INFO stats_Natives[];
struct weaponsVault {
char* name;
char* logname;
char name[32];
char logname[16];
short int ammoSlot;
bool used;
bool melee;
};

View File

@ -34,14 +34,13 @@ void Client_WeaponList(void* mValue){
wpnList |= (1<<iId);
weaponData[iId].ammoSlot = iSlot;
char* wpnPrefix = strstr( wpnName,"weapon_");
if ( wpnPrefix )
if ( strstr( wpnName,"weapon_") )
{
weaponData[iId].name = wpnPrefix + 7;
if ( strcmp( weaponData[iId].name, "hegrenade" ) == 0 )
weaponData[iId].name += 2;
weaponData[iId].logname = weaponData[iId].name;
if ( strcmp(wpnName+7,"hegrenade") == 0 )
strcpy(weaponData[iId].name,wpnName+9);
else
strcpy(weaponData[iId].name,wpnName+7);
strcpy(weaponData[iId].logname,weaponData[iId].name);
}
}
}
@ -75,6 +74,8 @@ void Client_Damage(void* mValue){
}
if( g_grenades.find(enemy , &pAttacker , &weapon ) )
pAttacker->saveHit( mPlayer , weapon , damage, aim );
else if ( strcmp("grenade",STRING(enemy->v.classname))==0 ) // ? more checks ?
weapon = CSW_C4;
}
}
@ -90,7 +91,8 @@ void Client_Damage_End(void* mValue){
MF_ExecuteForward( iFDamage,pAttacker->index , mPlayer->index , damage, weapon, aim, TA );
if ( !mPlayer->IsAlive() ){
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA);
if ( weapon != CSW_C4 )
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA);
MF_ExecuteForward( iFDeath,pAttacker->index, mPlayer->index, weapon, aim, TA );
}
}