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

@ -138,9 +138,11 @@ new g_HeadShots[7][] = {
"HS_MSG_7"
}
new g_teamsNames[2][] = {
new g_teamsNames[4][] = {
"TERRORIST",
"CT"
"CT",
"TERRORISTS",
"CTS"
}
public plugin_init() {
@ -244,11 +246,13 @@ public client_death(killer,victim,wpnindex,hitplace,TK) {
new eppl[32], epplnum
get_players(eppl,epplnum,"ae",g_teamsNames[team])
if (epplnum) {
new message[128]
format(message,127,"%d %s%s Remaining...",epplnum,g_teamsNames[team],(epplnum==1)?"":"S" )
set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3)
for(new a=0; a<pplnum; ++a) show_hudmessage(ppl[a],message)
//client_print(ppl[a],print_chat,message)
new message[128],team_name[32]
set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3)
for(new a=0; a<pplnum; ++a){
format(team_name,31,"%L",ppl[a],(epplnum==1)?g_teamsNames[team]:g_teamsNames[team+2])
format(message,127,"%L",ppl[a],"REMAINING",epplnum,team_name)
show_hudmessage(ppl[a],message)
}
}
}
}
@ -450,7 +454,14 @@ announceEvent( id, message[] ) {
show_hudmessage(0,"%L",LANG_PLAYER,message,name)
}
public eGotBomb(id) {
public eBombPickUp(id)
if (BombPickUp) announceEvent(id , "PICKED_BOMB")
public eBombDrop()
if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB")
public eGotBomb(id) {
g_Planter = id
if ( BombReached && read_data(1)==2 && g_LastOmg<get_gametime()) {
g_LastOmg = get_gametime() + 15.0
announceEvent(g_Planter, "REACHED_TARGET" )
@ -478,11 +489,10 @@ public bombTimer() {
public bomb_planted(planter){
g_Defusing = 0
if ( g_C4Timer != -2 ) {
if (BombPlanted) announceEvent(planter, "SET_UP_BOMB" )
g_C4Timer = get_cvar_num("mp_c4timer") - 2
set_task(1.0,"bombTimer",8038,"",0,"b")
}
if (BombPlanted) announceEvent(planter, "SET_UP_BOMB" )
g_C4Timer = get_cvar_num("mp_c4timer")
set_task(1.0,"bombTimer",8038,"",0,"b")
}
public bomb_planting(planter)
@ -493,21 +503,11 @@ public bomb_defusing(defuser){
g_Defusing = defuser
}
public bomb_defused(defuser){
public bomb_defused(defuser)
if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB" )
}
public bomb_explode(planter,defuser){
public bomb_explode(planter,defuser)
if (BombFailed && defuser) announceEvent(defuser , "FAILED_DEFU" )
}
public eBombPickUp(id){
if (BombPickUp) announceEvent(id , "PICKED_BOMB")
g_Planter = id
}
public eBombDrop()
if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB")
public plugin_modules()
{

44
dlls/csx/plugins/miscstats.txt Executable file
View File

@ -0,0 +1,44 @@
[en]
WITH = with
KNIFE_MSG_1 = %s sliced and diced %s
KNIFE_MSG_2 = %s pulled out knife and gutted %s
KNIFE_MSG_3 = %s sneaks carefully behind and knifed %s
KNIFE_MSG_4 = %s knived %s
LAST_MSG_1 = Now all depend on you!
LAST_MSG_2 = I hope you still have a healthpack.
LAST_MSG_3 = All your teammates were killed. Good luck!
LAST_MSG_4 = Now you are alone. Have fun!
HE_MSG_1 = %s sends a little gift to %s
HE_MSG_2 = %s throws a small present to %s
HE_MSG_3 = %s made a precision throw to %s
HE_MSG_4 = %s got a big explosion for %s
SHE_MSG_1 = %s detonated himself with a grenade
SHE_MSG_2 = %s trys the effect of an HE Grenade
SHE_MSG_3 = %s swallows grenades whole!
SHE_MSG_4 = %s explodes!
HS_MSG_1 = $kn killed $vn with a well^nplaced shot to the head!
HS_MSG_2 = $kn removed $vn's^nhead with the $wn
HS_MSG_3 = $kn turned $vn's head^ninto pudding with the $wn
HS_MSG_4 = $vn got pwned by $kn
HS_MSG_5 = $vn's head has been^nturned into red jello
HS_MSG_6 = $kn has superb aim with the $wn,^nas $vn well knows.
HS_MSG_7 = $vn's head stayed in $kn's^ncrosshairs a bit too long...
DOUBLE_KILL = Wow! %s made a double kill!!!
PREPARE_FIGHT = Prepare to FIGHT!^nRound %d
KILLED_ROW = You've killed %d in a row so far
DIED_ROUNDS = Careful! You've died %d rounds in a row now...
KILLED_CHICKEN = Somebody killed a chicken!!!
BLEW_RADIO = Somebody blew up the radio!!!
REACHED_TARGET = Omg! %s reached the target!
PLANT_BOMB = %s is planting the bomb!
DEFUSING_BOMB = %s is defusing the bomb...
SET_UP_BOMB = %s set us up the bomb!!!
DEFUSED_BOMB = %s defused the bomb!
FAILED_DEFU = %s failed to defuse the bomb...
PICKED_BOMB = %s picked up the bomb...
DROPPED_BOMB = %s dropped the bomb!!!
CT = CT
CTS = CTS
TERRORIST = TERRORIST
TERRORISTS = TERRORISTS
REMAINING = %d %s Remaining...

View File

@ -0,0 +1,177 @@
/* Gasnades */
#include <amxmodx>
#include <fun>
#include <engine>
#include <csx>
new g_Gas
//----------------------------------------------------------------------------------------------
public plugin_init()
{
register_plugin("Gasgrenades", "1.3 (CSX)", "RichoDemus/AssKicR/T(+)rget")
register_cvar("amx_gasnades", "1")
register_cvar("amx_gasdmg", "10")
register_cvar("amx_gascheck", "3")
register_cvar("amx_gasradius", "200")
register_cvar("amx_smokegasp", "1")
register_cvar("amx_gasobeyFF", "1")
g_Gas = custom_weapon_add("gasnade",0,"gasnade")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_sound("player/gasp1.wav")
precache_sound("player/gasp2.wav")
}
public gas(par[])
{
new grenadeid = par[1]
new id = par[0]
if ( !is_valid_ent(grenadeid) )
return
new player[3], inum, Float:temp_grenade[3], grenade[3], players[32]
if(get_cvar_num("amx_gasobeyFF") != 1)
get_players(players, inum) // Get number of players
else{
new FFOn = get_cvar_num("mp_friendlyfire")
if(FFOn == 0){
new team[33]
get_user_team(id, team, 32)
if(equali(team, "CT"))
get_players(players, inum, "ae", "TERRORIST")
else
get_players(players, inum, "ae", "CT")
}
else
get_players(players, inum) // Get number of players
}
entity_get_vector(grenadeid, EV_VEC_origin, temp_grenade) // Get the position of the grenade
grenade[0] = floatround(temp_grenade[0])
grenade[1] = floatround(temp_grenade[1])
grenade[2] = floatround(temp_grenade[2])
for(new i = 0; i < inum; ++i){ // Loop through all players
get_user_origin(players[i],player,0)
new distance = get_distance(grenade, player)
if((distance < get_cvar_num("amx_gasradius"))){ // Check who is standing close
if(get_cvar_num("amx_smokegasp") != 0){
if(get_cvar_num("amx_gascheck") >= 1){
new number = random_num(1, 2)
if(is_user_alive(players[i])){
switch (number){
case 1:emit_sound(players[i], CHAN_VOICE, "player/gasp1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
case 2:emit_sound(players[i], CHAN_VOICE, "player/gasp2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
}
}
message_begin(MSG_ONE, get_user_msgid("Damage"), {0,0,0}, players[i])
write_byte(30) // dmg_save
write_byte(30) // dmg_take
write_long((1 << 16)) // visibleDamageBits
write_coord(grenade[0]) // damageOrigin.x
write_coord(grenade[1]) // damageOrigin.y
write_coord(grenade[2]) // damageOrigin.z
message_end()
if(is_user_alive(id))
ExtraDamage(players[i], id, get_cvar_num("amx_gasdmg"), "gasgrenade")
}
}
set_task(get_cvar_float("amx_gascheck"), "gas",grenadeid,par,2) // If the grenade still exists we do a new check in get_cvar_num("amx_gascheck") second
}
//----------------------------------------------------------------------------------------------
public grenade_throw(index,greindex,wId){
if ( task_exists(greindex) )
remove_task(greindex)
if( get_cvar_num("amx_gasnades") !=1 || wId != CSW_SMOKEGRENADE )
return PLUGIN_CONTINUE
if (g_Gas) custom_weapon_shot(g_Gas,index)
new par[2]
par[0] = index
par[1] = greindex
set_task(1.5, "gas", greindex,par,2)
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
stock ExtraDamage(id, attacker, damage, weaponDescription[])
{
if(is_user_alive(id))
{
new userHealth = get_user_health(id)
set_user_health(id, userHealth - damage)
if (g_Gas)
custom_weapon_dmg(g_Gas,attacker,id,damage)
if(userHealth - damage <= 0)
{
logKill(attacker, id, weaponDescription)
if(get_user_team(id) != get_user_team(attacker))
{
// The person dying shouldn't get negative credit for this kill (so add it back)
set_user_frags(id, get_user_frags(id) + 1)
// The killing should get credit for the frag
set_user_frags(attacker, get_user_frags(attacker) + 1)
}
else
{
// The person dying shouldn't get negative credit for this kill (so add it back)
set_user_frags(id, get_user_frags(id) + 1)
// The killer killed a teammember or self
// Engine gives credit for the kill so let's take away that + 1
set_user_frags(attacker, get_user_frags(attacker) - 2)
}
}else{
if(get_cvar_num("mp_logdetail") == 3){
logDmg(attacker, id, weaponDescription,"body",damage,userHealth-damage)
}
}
}
}
//----------------------------------------------------------------------------------------------
/* Log a kill using standard HL-logging format */
stock logKill(attacker, victim, weaponDescription[])
{
// Save Hummiliation
new namea[24], namev[24], authida[20], authidv[20], teama[10], teamv[10]
// Info On Attacker
get_user_name(attacker, namea, 23)
get_user_team(attacker, teama, 9)
get_user_authid(attacker, authida, 19)
// Info On Victim
get_user_name(victim, namev, 23)
get_user_team(victim, teamv, 9)
get_user_authid(victim, authidv, 19)
// Log This Kill
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",
namea, get_user_userid(attacker), authida, teama, namev, get_user_userid(victim), authidv, teamv, weaponDescription)
}
/* Log damage using standard HL-logging format */
stock logDmg(attacker, victim, weaponDescription[],hit[],damage,health)
{
// Save Hummiliation
new namea[24], namev[24], authida[20], authidv[20], teama[10], teamv[10]
// Info On Attacker
get_user_name(attacker, namea, 23)
get_user_team(attacker, teama, 9)
get_user_authid(attacker, authida, 19)
// Info On Victim
get_user_name(victim, namev, 23)
get_user_team(victim, teamv, 9)
get_user_authid(victim, authidv, 19)
// Log This Damage
log_message("^"%s<%d><%s><%s>^" attacked ^"%s<%d><%s><%s>^" with ^"%s^" (hit ^"%s^") (damage ^"%d^") (health ^"%d^")",
namea,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv,weaponDescription,hit,damage,health)
}
//----------------------------------------------------------------------------------------------

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 );
}
}