Raised This Month: $ Target: $400
 0% 

Request for miscstats


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Elusive13
Member
Join Date: Sep 2011
Old 02-03-2017 , 15:00   Request for miscstats
Reply With Quote #1

Hello. Can anyone edit this plugin because I do not have the necessary knowledge. The script of this plugin is for AMXMod and I want it for AMXModX..
I need it becouse i dont have Bomb,Grenade and Suicide sounds in my old and original miscstats.sma.
I would be very grateful. Thank you.
Code:
#include <translator>
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <VexdUM>

public MultiKill
public MultiKillSound
public BombPlanting
public BombDefusing
public BombPlanted
public BombPlantedSound
public BombDefused
public BombDefusedSound
public BombFailed
public BombFailedSound
public BombPickUp
public BombDrop
public BombCountHUD
public BombCountVoice
public BombCountDef
public BombReached
public ItalyBonusKill
public EnemyRemaining
public LastMan
public LastManSound
public KnifeKill
public KnifeKillSound
public GrenadeKill
public GrenadeKillSound
public GrenadeSuicide
public GrenadeSuicideSound
public HeadShotKill
public HeadShotKillSound
public RoundCounter
public RoundCounterSound
public KillingStreak
public KillingStreakSound
public KillingStreakChat
public KillingStreakHUD
public KillingStreakEndHUD
public KillingStreakSay
public DoubleKill
public DoubleKillSound
public PlayerName
public FirstBloodSound
public FallKill
public Suicide
public AirKill
public WaterKill
public WallShot

new g_streakKills[33][2]
new g_multiKills[33][2]
new g_Planter
new g_Defuser
new g_C4Timer
new g_mp_c4timer
new g_Defusing
new Float:g_LastOmg
new Float:g_LastPlan
new g_LastAnnounce
new g_roundCount
new Float:g_doubleKill
new g_doubleKillId
new g_friend[33] = {0,...}
new g_firstBlood

new bool:g_bConnecting[33]
new g_iConnected[33] // 1 = normal player, 2 = bot
new g_kills[33] = {0,...}
new g_deaths[33] = {0,...}
new g_knife[33] = {0,...}
new g_hs[33] = {0,...}
new g_nade[33] = {0,...}
new g_longestKillStreak[33] = {0,...}
new g_longestDeathStreak[33] = {0,...}
new Float:g_DeathStats[33] = {0.0,...}

const TASK_bombTimer = 8038
const TASKID_showKillingStreakHud = 12345

const g_iMsgIdScoreInfo = 85

new const g_disabledMsg[] = "Server has disabled that option."

new Float:g_gameTime
new g_funRunning
new g_vexdRunning

new g_cvar_amx_bomb_frags
new g_cvar_amx_statsx_duration

new g_cvar_mp_freezetime
new g_cvar_mp_c4timer

// top of MultiKill messages
const MAX_MULTIKILL_MESSAGES = 7 // increase/decrease this number if your add/remove a MultiKill message
new const g_MultiKillMsg[MAX_MULTIKILL_MESSAGES][] = {
  "Multi-Kill! %s^nwith %d kills (%d hs)",
  "Ultra-Kill!!! %s^nwith %d kills (%d hs)",
  "%s IS ON A KILLING SPREE!!!^nwith %d kills (%d hs)",
  "RAMPAGE!!! %s^nwith %d kills (%d hs)",
  "%s IS UNSTOPPABLE!!!^nwith %d kills (%d hs)",
  "%s IS A MONSTER!^nwith %d kills (%d hs)",
  "%s IS GODLIKE!!!!^nwith %d kills (%d hs)"
}
new const g_Sounds[MAX_MULTIKILL_MESSAGES][] = {
  "misc/multikill",
  "misc/ultrakill",
  "misc/killingspree",
  "misc/rampage",
  "misc/unstoppable",
  "misc/monsterkill",
  "misc/godlike"
}
new const g_KillingMsg[MAX_MULTIKILL_MESSAGES][] = {
  "%s: Multi-Kill!",
  "%s: Ultra-Kill!!!",
  "%s IS ON A KILLING SPREE!!!",
  "%s: RAMPAGE!!!",
  "%s IS UNSTOPPABLE!!!",
  "%s IS A MONSTER!",
  "%s IS GODLIKE!!!"
}
// end of MultiKill messages

new const g_KnifeMsg[][] = {
  "%s sliced and diced %s",
  "%s pulled out knife and gutted %s",
  "%s sneaked carefully behind and knifed %s",
  "%s knifed %s"
}

new const g_LastMessages[][] = {
  "Now everything depends on you!",
  "I hope you still have a healthpack.",
  "All your teammates were killed. Good luck!",
  "Now you are alone. Have fun!"
}

new const g_HeMessages[][] = {
  "%s sends a little gift to %s",
  "%s throws a small present to %s",
  "%s made a precision throw to %s",
  "%s got a big explosion for %s"
}

new const g_SHeMessages[][] = {
  "%s detonated himself with a grenade",
  "%s tried the effect of a HE Grenade",
  "%s kicked a grenade into his own ass",
  "%s exploded!"
}

new const g_HeadShots[][] = {
  "$kn killed $vn with a well^nplaced shot to the head!",
  "$kn removed $vn's^nhead with the $wn",
  "$kn turned $vn's head^ninto pudding with the $wn",
  "$vn got pwned by $kn",
  "$vn's head has been^nturned into red jello",
  "$kn has superb aim with the $wn,^nas $vn well knows",
  "$vn's head stayed in $kn's^ncrosshairs a bit too long..."
}

new const g_FallKillMessages[][] = {
  "%s tried free fall without a parachute!",
  "%s messed up his jump!",
  "%s forgot laws of gravity!"
}

new const g_SuicideMessages[][] = {
  "%s knows how the ^"kill^" command works!",
  "%s prefered to kill himself rather than die on the field!"
}

new const g_AirKillMessages[][] = {
  "$vn was killed by $kn^nwhile he was in the air",
  "$vn was killed by $kn^nwhile he was flying like a pigeon",
  "$vn could not reach the ground^nbecause he was shot in the air by $kn"
}

new const g_WaterKillMessages[][] = {
  "$vn was killed by $kn^nwhile he was in the water",
  "$vn was killed by $kn^nwhile has was having a bath",
  "$vn was killed by $kn^nwhile he was having a wash"
}

new const g_WallShotMessages[][] = {
  "$kn killed $vn^nthrough the wall! HaXorz! :)",
  "$kn killed $vn^nwith a nice wallshot!",
  "$kn killed $vn^nwith his wallhack! :)"
}

new const g_teamsNames[2][] = {
  "TERRORIST",
  "CT"
}

public disable_natives_check() {
}

public plugin_init() {
  if(cvar_exists("amxmodx_version")) load_module("error")
  load_translations("miscstats")
  register_plugin(_T("Misc. Stats"),AMX_VERSION,"AMX Mod Team")
  g_funRunning = is_module_running("Fun")
  g_vexdRunning = is_module_running("VexdUM")
  if(g_funRunning) {
    g_cvar_amx_bomb_frags = register_cvar("amx_bomb_frags","3")
  }
  if(g_vexdRunning) {
    if(get_cvar_pointer("amx_bomb_frags") == 0)
      g_cvar_amx_bomb_frags = register_cvar("amx_bomb_frags","3")
  }
  register_clcmd("say /streak","cmdKillingStreak",0,_T("- display info. about your killing streak"))
  register_event("ResetHUD","eResetHud","be")
  register_event("DeathMsg","eDeathMsg","a")
  register_logevent("SuicideMsg",4,"1=committed suicide with")
  register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w")
  register_event("SendAudio","eEndRound","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
  register_logevent("eNewRound",2,"1=Round_Start")
  register_event("StatusValue","setTeam","be","1=1")
  register_event("StatusValue","showStatus","be","1=2","2!0")
  register_event("StatusValue","hideStatus","be","1=1","2=0")
  new mapname[32]
  get_mapname(mapname, 31)
  if(equali(mapname, "cs_italy")) {
    register_event("23","chickenKill","a","1=108","15=4")
    register_event("23","radioKill","a","1=108","15=2")
  }
  else if(g_vexdRunning) {
    if((find_entity(-1, "info_bomb_target") > 0) || (find_entity(-1, "func_bomb_target") > 0)) {
      register_event("StatusIcon","eGotBomb","be","1=1","1=2","2=c4")
      register_event("SendAudio","eBombPlanted","a","2&%!MRAD_BOMBPL")
      register_event("SendAudio","eBombDef","a","2&%!MRAD_BOMBDEF")
      register_event("TextMsg","eBombFail","a","2&#Target_B")
      register_event("BarTime","eBombDefG","be","1=10","1=5","1=3")
      register_event("BarTime","eBombDefL","be","1=0")
      register_event("TextMsg","eBombPickUp","bc","2&#Got_bomb")
      register_event("TextMsg","eBombDrop","bc","2&#Game_bomb_d")
    }
  }
  else if(equali(mapname, "de_", 3) || equali(mapname, "csde_", 5)) {
    register_event("StatusIcon","eGotBomb","be","1=1","1=2","2=c4")
    register_event("SendAudio","eBombPlanted","a","2&%!MRAD_BOMBPL")
    register_event("SendAudio","eBombDef","a","2&%!MRAD_BOMBDEF")
    register_event("TextMsg","eBombFail","a","2&#Target_B")
    register_event("BarTime","eBombDefG","be","1=10","1=5","1=3")
    register_event("BarTime","eBombDefL","be","1=0")
    register_event("TextMsg","eBombPickUp","bc","2&#Got_bomb")
    register_event("TextMsg","eBombDrop","bc","2&#Game_bomb_d")
  }
}

public plugin_precache() {
  new filename[64]
  build_path(filename, 63, "$configdir/stats.ini")
  if(file_exists(filename)) {
    new text[32]
    new len, pos = 0, xid
    while((pos = read_file(filename, pos, text, 31, len))) {
      if(!len || text[0] == ';' || text[0] == '/' || text[0] == '#') continue // line is a comment
      parse(text, text, 31)
      if((xid = get_xvar_id(text)) != -1)
        set_xvar_num(xid, 1)
    }
  }
#if defined AUTOMATIC_PRECACHING
  if(MultiKillSound || KillingStreakSound) {
    for(new i = 0; i < MAX_MULTIKILL_MESSAGES; ++i)
      precache_sound_custom(g_Sounds[i])
  }
  if(BombPlantedSound) {
    precache_sound_custom("djeyl/c4powa")
  }
  if(BombDefusedSound) {
    precache_sound_custom("djeyl/laugh")
  }
  if(BombFailedSound || GrenadeSuicideSound) {
    precache_sound_custom("djeyl/witch")
  }
  if(LastManSound) {
    precache_sound_custom("misc/maytheforce")
    precache_sound_custom("misc/oneandonly")
  }
  if(KnifeKillSound) {
    precache_sound_custom("misc/humiliation")
  }
  if(GrenadeKillSound) {
    precache_sound_custom("djeyl/grenade")
  }
  if(HeadShotKillSound) {
    precache_sound_custom("misc/headshot")
  }
  if(RoundCounterSound) {
    precache_sound_custom("misc/prepare")
  }
  if(DoubleKillSound) {
    precache_sound_custom("misc/doublekill")
  }
  if(FirstBloodSound) {
    precache_sound_custom("misc/firstblood")
  }
#endif
}

#if defined AUTOMATIC_PRECACHING
new g_precSoundCust[48]
public precache_sound_custom(const sound[]) {
  formatex(g_precSoundCust, 47, "sound/%s.wav", sound)
  if(file_exists(g_precSoundCust)) {
    precache_sound(g_precSoundCust[6])
  }
}
#endif

public plugin_cfg() {
  new const g_addStast[] = "amx_statscfg add ^"%s^" %s"
  server_cmd(g_addStast,"MultiKill","MultiKill")
  server_cmd(g_addStast,"MultiKill sound","MultiKillSound")
  server_cmd(g_addStast,"Bomb planting","BombPlanting")
  server_cmd(g_addStast,"Bomb defusing","BombDefusing")
  server_cmd(g_addStast,"Bomb planted","BombPlanted")
  server_cmd(g_addStast,"Bomb planted sound","BombPlantedSound")
  server_cmd(g_addStast,"Bomb defuse succ.","BombDefused")
  server_cmd(g_addStast,"Bomb defuse succ. sound","BombDefusedSound")
  server_cmd(g_addStast,"Bomb def. failure","BombFailed")
  server_cmd(g_addStast,"Bomb def. failure sound","BombFailedSound")
  server_cmd(g_addStast,"Bomb PickUp","BombPickUp")
  server_cmd(g_addStast,"Bomb drop","BombDrop")
  server_cmd(g_addStast,"Bomb countdown HUD","BombCountHUD")
  server_cmd(g_addStast,"Bomb countdown voice","BombCountVoice")
  server_cmd(g_addStast,"Bomb countdown (defuser)","BombCountDef")
  server_cmd(g_addStast,"Bomb site reached","BombReached")
  server_cmd(g_addStast,"Italy bonus kill","ItalyBonusKill")
  server_cmd(g_addStast,"Last man","LastMan")
  server_cmd(g_addStast,"Last man sound","LastManSound")
  server_cmd(g_addStast,"Knife kill","KnifeKill")
  server_cmd(g_addStast,"Knife kill sound","KnifeKillSound")
  server_cmd(g_addStast,"Grenade kill","GrenadeKill")
  server_cmd(g_addStast,"Grenade kill sound","GrenadeKillSound")
  server_cmd(g_addStast,"Grenade suicide","GrenadeSuicide")
  server_cmd(g_addStast,"Grenade suicide sound","GrenadeSuicideSound")
  server_cmd(g_addStast,"HeadShot kill","HeadShotKill")
  server_cmd(g_addStast,"HeadShot kill sound","HeadShotKillSound")
  server_cmd(g_addStast,"Round counter","RoundCounter")
  server_cmd(g_addStast,"Round counter sound","RoundCounterSound")
  server_cmd(g_addStast,"Killing streak","KillingStreak")
  server_cmd(g_addStast,"Killing streak sound","KillingStreakSound")
  server_cmd(g_addStast,"Killing streak chat","KillingStreakChat")
  server_cmd(g_addStast,"Killing streak HUD","KillingStreakHUD")
  server_cmd(g_addStast,"Killing streak end HUD","KillingStreakEndHUD")
  server_cmd(g_addStast,"Killing streak say","KillingStreakSay")
  server_cmd(g_addStast,"Double kill","DoubleKill")
  server_cmd(g_addStast,"Double kill sound","DoubleKillSound")
  server_cmd(g_addStast,"Enemy remaining","EnemyRemaining")
  server_cmd(g_addStast,"Player name","PlayerName")
  server_cmd(g_addStast,"First blood sound","FirstBloodSound")
  server_cmd(g_addStast,"Fall kill","FallKill")
  if(g_vexdRunning) {
    server_cmd(g_addStast,"Suicide","Suicide")
    server_cmd(g_addStast,"Air kill","AirKill")
    server_cmd(g_addStast,"Water kill","WaterKill")
    server_cmd(g_addStast,"Wall shot","WallShot")
  }
  g_cvar_amx_statsx_duration = get_cvar_pointer("amx_statsx_duration")
  g_cvar_mp_freezetime = get_cvar_pointer("mp_freezetime")
  g_cvar_mp_c4timer = get_cvar_pointer("mp_c4timer")
}

public client_connect(id) {
  g_bConnecting[id] = true
  g_multiKills[id] = {0, 0}
  g_streakKills[id] = {0, 0}
  g_kills[id] = 0
  g_deaths[id] = 0
  g_knife[id] = 0
  g_hs[id] = 0
  g_nade[id] = 0
  g_longestDeathStreak[id] = 0
  g_longestKillStreak[id] = 0
  g_DeathStats[id] = 0.0
}

public client_putinserver(id) {
  g_bConnecting[id] = false
  g_iConnected[id] = is_user_bot(id) ? 2 : 1
}

public client_disconnect(id) {
  g_bConnecting[id] = false
  g_iConnected[id] = 0
}

public eDeathMsg() {
  new killerId = read_data(1)
  if(killerId == 0)
    return

  new victimId = read_data(2)

  g_DeathStats[victimId] = get_gametime() + get_cvarptr_float(g_cvar_amx_statsx_duration)

  new bool:enemykill = (get_user_team(killerId) != get_user_team(victimId))
  new headshot = read_data(3)

  new dm_ppl[32], plnum = 0
  get_players(dm_ppl, plnum, "c")

  if(KillingStreakHUD) {
    new param[8]
    param[0] = victimId
    param[1] = g_kills[victimId]
    param[2] = g_hs[victimId]
    param[3] = g_nade[victimId]
    param[4] = g_knife[victimId]
    param[5] = g_longestKillStreak[victimId]
    param[6] = g_longestDeathStreak[victimId]
    param[7] = 1
    set_task(12.0, "showKillingStreakHud", TASKID_showKillingStreakHud+victimId, param, 8)
  }
  if((g_kills[victimId] > 4) && KillingStreakEndHUD && killerId != victimId) {
    new param[6]
    param[0] = victimId
    param[1] = killerId
    param[2] = g_kills[victimId]
    param[3] = g_hs[victimId]
    param[4] = g_nade[victimId]
    param[5] = g_knife[victimId]
    set_task(12.0, "showKillingStreakEndHud", 23456+victimId, param, 6)
  }
  if(headshot && enemykill) {
    ++g_hs[killerId]
  }
  new arg[4]
  read_data(4, arg, 3)
  if(equal(arg, "kni") && enemykill) {
    ++g_knife[killerId]
  }
  else if(equal(arg, "gre") && enemykill) {
    ++g_nade[killerId]
  }
  if(enemykill) {
    g_kills[killerId] += 1
    g_deaths[killerId] = 0
  }
  else g_kills[killerId] -= 1

  g_kills[victimId] = 0
  g_deaths[victimId] += 1
  g_hs[victimId] = 0
  g_knife[victimId] = 0
  g_nade[victimId] = 0
  if(g_kills[killerId] > g_longestKillStreak[killerId]) {
    g_longestKillStreak[killerId] = g_kills[killerId]
  }
  if(g_deaths[victimId] > g_longestDeathStreak[victimId]) {
    g_longestDeathStreak[victimId] = g_deaths[victimId]
  }

  new tempId

  if(g_firstBlood) {
    g_firstBlood = 0
    if(FirstBloodSound) play_wav("misc/firstblood")
  }
  if((KillingStreak || KillingStreakSound) && enemykill) {
    ++g_streakKills[killerId][0]
    g_streakKills[killerId][1] = 0
    ++g_streakKills[victimId][1]
    g_streakKills[victimId][0] = 0
    new a = g_streakKills[killerId][0] - 3
    if((a > -1) && !(a % 2)) {
      new name[32]
      get_user_name(killerId, name, 31)
      if((a >>= 1) > (MAX_MULTIKILL_MESSAGES-1)) a = MAX_MULTIKILL_MESSAGES-1
      if(KillingStreak) {
        set_hudmessage(0, 100, 255, 0.05, 0.53, 2, 0.02, 6.0, 0.01, 0.1, 3)
        for(new i = 0; i < plnum; ++i) {
          tempId = dm_ppl[i]
          if(g_DeathStats[tempId] > get_gametime())
            continue
          show_hudmessage(tempId, _T(g_KillingMsg[a]), name)
        }
      }
      if(KillingStreakSound) play_wav(g_Sounds[a])
    }
  }
  if(MultiKill || MultiKillSound) {
    if(killerId && enemykill) {
      ++g_multiKills[killerId][0]
      g_multiKills[killerId][1] += headshot
      new param[2]
      param[0] = killerId
      param[1] = g_multiKills[killerId][0]
      set_task(4.0 + float(param[1]), "checkKills", 0, param, 2)
    }
  }
  if(EnemyRemaining) {
    new ppl[32], pplnum = 0
    new team = get_user_team(victimId) - 1
    if(team == 0 || team == 1) get_players(ppl, pplnum, "e", g_teamsNames[1 - team])
    if(pplnum) {
      new eppl[32], epplnum
      get_players(eppl, epplnum, "ae", g_teamsNames[team])
      if(epplnum) {
        new message[128], teammsg[64]
        formatex(teammsg, 63, "%s%s", g_teamsNames[team], (epplnum == 1) ? "" : "S")
        set_hudmessage(255, 255, 255, 0.02, 0.9, 2, 0.05, 0.1, 0.02, 3.0, 3)
        for(new a = 0; a < pplnum; ++a) {
          tempId = ppl[a]
          if(g_DeathStats[tempId] > get_gametime())
            continue
          formatex(message, 127, _T("%d %s remaining...",tempId), epplnum, _T(teammsg,tempId))
          show_hudmessage(tempId, message)
          //client_print(tempId,print_chat,message)
        }
      }
    }
  }
  if(LastMan) {
    new cts[32], ts[32], ctsnum, tsnum
    get_players(cts, ctsnum, "ae", g_teamsNames[1])
    get_players(ts, tsnum, "ae", g_teamsNames[0])
    if(ctsnum == 1 && tsnum == 1) {
      new ctname[32], tname[32]
      get_user_name(cts[0], ctname, 31)
      get_user_name(ts[0], tname, 31)
      set_hudmessage(0, 255, 255, -1.0, 0.37, 0, 6.0, 6.0, 0.5, 0.15, 3)
      for(new a = 0; a < plnum; ++a) {
        tempId = dm_ppl[a]
        if(g_DeathStats[tempId] > get_gametime())
            continue
        show_hudmessage(tempId, _T("%s vs. %s"), ctname, tname)
      }
      if(LastManSound) play_wav("misc/maytheforce")
    }
    else if(!g_LastAnnounce) {
      new opposite = 0, team = 0
      if(ctsnum == 1 && tsnum > 1) {
        g_LastAnnounce = cts[0]
        opposite = tsnum
        team = 0
      }
      else if(tsnum == 1 && ctsnum > 1) {
        g_LastAnnounce = ts[0]
        opposite = ctsnum
        team = 1
      }
      if(g_LastAnnounce) {
        new name[32]
        new teammsg[64]
        get_user_name(g_LastAnnounce, name, 31)
        set_hudmessage(0, 255, 255, -1.0, 0.37, 0, 6.0, 6.0, 0.5, 0.15, 3)
        for(new a = 0; a < plnum; ++a) {
          tempId = dm_ppl[a]
          if(g_DeathStats[tempId] > get_gametime())
            continue
          formatex(teammsg, 63, "%s%s", g_teamsNames[team], (opposite == 1) ? "" : "S")
          show_hudmessage(tempId, "%s (%d HP) vs. %d %s : %s",
            name,
            get_user_health(g_LastAnnounce),
            opposite,
            _T(teammsg),
            _T(g_LastMessages[random_num(0, charsmax(g_LastMessages))]))
        }
        if(LastManSound && !g_bConnecting[g_LastAnnounce]) client_cmd(g_LastAnnounce, "spk misc/oneandonly")
      }
    }
  }
  if((KnifeKill || KnifeKillSound) && equal(arg, "kni")) {
    if(KnifeKill && killerId != victimId) {
      new killer[32], victim[32]
      get_user_name(killerId, killer, 31)
      get_user_name(victimId, victim, 31)
      set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
      for(new a = 0; a < plnum; ++a) {
        tempId = dm_ppl[a]
        if(g_DeathStats[tempId] > get_gametime())
          continue
        show_hudmessage(tempId, _T(g_KnifeMsg[random_num(0, charsmax(g_KnifeMsg))]), killer, victim)
      }
    }
    if(KnifeKillSound) play_wav("misc/humiliation")
  }
  else if((GrenadeKill || GrenadeKillSound || GrenadeSuicide || GrenadeSuicideSound) && equal(arg, "gre")) {
    new killer[32], victim[32]
    get_user_name(killerId, killer, 31)
    get_user_name(victimId, victim, 31)
    set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
    if(killerId != victimId) {
      if(GrenadeKill) {
        for(new a = 0; a < plnum; ++a) {
          tempId = dm_ppl[a]
          if(g_DeathStats[tempId] > get_gametime())
            continue
          show_hudmessage(tempId, _T(g_HeMessages[random_num(0, charsmax(g_HeMessages))]), killer, victim)
        }
      }
      if(GrenadeKillSound) play_wav("djeyl/grenade")
    }
    else {
      if(GrenadeSuicide) {
        for(new a = 0; a < plnum; ++a) {
          tempId = dm_ppl[a]
          if(g_DeathStats[tempId] > get_gametime())
            continue
          show_hudmessage(tempId, _T(g_SHeMessages[random_num(0, charsmax(g_SHeMessages))]), victim)
        }
      }
      if(GrenadeSuicideSound) play_wav("djeyl/witch")
    }
  }
  if(headshot && (HeadShotKill || HeadShotKillSound) && !equal(arg, "kni")) {
    if(HeadShotKill && killerId != victimId) {
      new killer[32], victim[32], weapon[32], message[128]
      get_user_name(killerId, killer, 31)
      get_user_name(victimId, victim, 31)
      read_data(4, weapon, 31)
      set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1)
      for(new a = 0; a < plnum; ++a) {
        tempId = dm_ppl[a]
        if(g_DeathStats[tempId] > get_gametime())
            continue
        copy(message, 127, _T(g_HeadShots[random_num(0, charsmax(g_HeadShots))],tempId))
        replace(message, 127, "$vn", victim)
        replace(message, 127, "$wn", weapon)
        replace(message, 127, "$kn", killer)
        show_hudmessage(tempId, message)
      }
    }
    if(HeadShotKillSound) {
      client_cmd(killerId, "spk misc/headshot")
      client_cmd(victimId, "spk misc/headshot")
    }
  }
  if(DoubleKill || DoubleKillSound) {
    new Float:nowtime = get_gametime()
    if(g_doubleKill == nowtime && g_doubleKillId == killerId) {
      if(DoubleKill) {
        new name[32]
        get_user_name(killerId, name, 31)
        set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
        for(new a = 0; a < plnum; ++a) {
          tempId = dm_ppl[a]
          if(g_DeathStats[tempId] > get_gametime())
            continue
          show_hudmessage(tempId, _T("Wow! %s made a double kill!!!"), name)
        }
      }
      if(DoubleKillSound) play_wav("misc/doublekill")
    }
    g_doubleKill = nowtime
    g_doubleKillId = killerId
  }
  if(g_vexdRunning) {
    if(AirKill && killerId != victimId && !(entity_get_int(victimId, EV_INT_flags) & FL_ONGROUND)) {
      new killer[32], victim[32], message[128]
      get_user_name(killerId, killer, 31)
      get_user_name(victimId, victim, 31)
      set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1)
      for(new a = 0; a < plnum; ++a) {
        tempId = dm_ppl[a]
        if(g_DeathStats[tempId] > get_gametime())
          continue
        copy(message, 127, _T(g_AirKillMessages[random_num(0, charsmax(g_AirKillMessages))],tempId))
        replace(message, 127, "$vn", victim)
        replace(message, 127, "$kn", killer)
        show_hudmessage(tempId, message)
      }
    }
    new waterLvl
    if(WaterKill && killerId != victimId && ((waterLvl = entity_get_int(victimId, EV_INT_waterlevel)) == 2 || waterLvl == 3)) {
      new killer[32], victim[32], message[128]
      get_user_name(killerId, killer, 31)
      get_user_name(victimId, victim, 31)
      set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1)
      for(new a = 0; a < plnum; ++a) {
        tempId = dm_ppl[a]
        if(g_DeathStats[tempId] > get_gametime())
          continue
        copy(message, 127, _T(g_WaterKillMessages[random_num(0, charsmax(g_WaterKillMessages))], tempId))
        replace(message, 127, "$vn", victim)
        replace(message, 127, "$kn", killer)
        show_hudmessage(tempId, message)
      }
    }
    if(WallShot && killerId != victimId && !equal(arg, "kni") && !equal(arg, "gre") && !can_see(killerId, victimId)) {
      new killer[32], victim[32], message[128]
      get_user_name(killerId, killer, 31)
      get_user_name(victimId, victim, 31)
      set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1)
      for(new a = 0; a < plnum; ++a) {
        tempId = dm_ppl[a]
        if(g_DeathStats[tempId] > get_gametime())
          continue
        copy(message, 127, _T(g_WallShotMessages[random_num(0, charsmax(g_WallShotMessages))], tempId))
        replace(message, 127, "$vn", victim)
        replace(message, 127, "$kn", killer)
        show_hudmessage(tempId, message)
      }
    }
  }
}

public SuicideMsg() {
  if(FallKill) {
    new arg[64]
    read_logargv(0, arg, 63)
    new name[32]
    parse_loguser(arg, name, 31)
    set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
    new players[32], pnum
    get_players(players, pnum, "c")
    for(new i = 0; i < pnum; ++i) {
      if(g_DeathStats[players[i]] > get_gametime())
        continue
      show_hudmessage(players[i], _T(g_FallKillMessages[random_num(0, charsmax(g_FallKillMessages))]), name)
    }
  }
}

public client_kill(id) {
  if(g_vexdRunning && Suicide && is_user_alive(id)) {
    new name[32]
    get_user_name(id, name, 31)
    set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
    new players[32], pnum
    get_players(players, pnum, "c")
    for(new i = 0; i < pnum; ++i) {
      if(g_DeathStats[players[i]] > get_gametime())
        continue
      show_hudmessage(players[i], _T(g_SuicideMessages[random_num(0, charsmax(g_SuicideMessages))]), name)
    }
  }
}

public hideStatus(id) {
  if(g_iConnected[id] == 1) {
    if(PlayerName) {
      set_hudmessage(0, 0, 0, 0.0, 0.0, 0, 0.0, 0.01, 0.0, 0.0, 4)
      show_hudmessage(id, "")
    }
  }
}

public setTeam(id) {
  g_friend[id] = read_data(2)
}

public showStatus(id) {
  if(g_iConnected[id] == 1) {
    if(PlayerName) {
      new name[32], pid = read_data(2)
      get_user_name(pid, name, 31)
      new color1 = 0, color2 = 0
      if(get_user_team(pid) == 1)
        color1 = 255
      else
        color2 = 255
      if(g_friend[id] == 1) { // friend
        new clip, ammo, wpnid = get_user_weapon(pid,clip,ammo)
        if(wpnid > 0) {
          new wpnname[32]
          get_weaponname(wpnid, wpnname, 31)
          set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4)
          show_hudmessage(id, _T("%s -- %d HP / %d AP / %s"), name,
            get_user_health(pid), get_user_armor(pid), wpnname[7])
        }
      }
      else {
        set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4)
        show_hudmessage(id, name)
      }
    }
  }
}

public eNewRound() {
  g_firstBlood = 1
  g_C4Timer = 0
  g_mp_c4timer = get_cvarptr_num(g_cvar_mp_c4timer)
  ++g_roundCount
  if(RoundCounter) {
    set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
    show_hudmessage(0, _T("Prepare to FIGHT!^nRound %d"), g_roundCount)
  }
  if(RoundCounterSound) play_wav("misc/prepare")
  if(KillingStreakChat) {
    new appl[32], ppl, i
    get_players(appl, ppl, "ac")
    for(new a = 0; a < ppl; ++a) {
      i = appl[a]
      if(g_streakKills[i][0] >= 2)
        client_print(i, print_chat, _T("* You've killed %d in a row so far!"), g_streakKills[i][0])
      else if(g_streakKills[i][1] >= 2)
        client_print(i, print_chat, _T("* Careful! You've died %d rounds in a row now..."), g_streakKills[i][1])
    }
  }
}

public eRestart() {
  eEndRound()
  g_roundCount = 0
  g_firstBlood = 1
  for(new a = 0; a < 33; ++a) {
    g_DeathStats[a] = 0.0
    g_kills[a] = 0
    g_deaths[a] = 0
    g_knife[a] = 0
    g_hs[a] = 0
    g_nade[a] = 0
    g_longestKillStreak[a] = 0
    g_longestDeathStreak[a] = 0
    g_multiKills[a] = {0, 0}
    g_streakKills[a] = {0, 0}
  }
}

public eEndRound() {
  g_LastOmg = 0.0
  g_LastPlan = 0.0
  remove_task(TASK_bombTimer)
  g_LastAnnounce = 0
  set_task(0.3, "resetC4Timer", 978744)
}

public resetC4Timer() {
  g_C4Timer = -2
}

public checkKills(param[]) {
  new id = param[0]
  new a = param[1]
  if(a == g_multiKills[id][0]) {
    a -= 3
    if(a > -1) {
      if(MultiKill) {
        if(a > (MAX_MULTIKILL_MESSAGES-1)) a = MAX_MULTIKILL_MESSAGES-1
        new name[32]
        get_user_name(id, name, 31)
        new ck_ppl[32], plnum = 0
        get_players(ck_ppl, plnum, "c")
        set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
        for(new i = 0; i < plnum; ++i) {
          if(g_DeathStats[ck_ppl[i]] > get_gametime())
            continue
          show_hudmessage(ck_ppl[i], _T(g_MultiKillMsg[a]), name, g_multiKills[id][0], g_multiKills[id][1])
        }
      }
      if(MultiKillSound) {
        if(a > (MAX_MULTIKILL_MESSAGES-1)) a = MAX_MULTIKILL_MESSAGES-1
        play_wav(g_Sounds[a])
      }
    }
    g_multiKills[id] = {0, 0}
  }
}

public chickenKill() {
  if(ItalyBonusKill) announceEvent(0, "Somebody killed a chicken!!!")
}

public radioKill() {
  if(ItalyBonusKill) announceEvent(0, "Somebody blew up the radio!!!")
}

announceEvent(id,const message[]) {
  new name[32]
  get_user_name(id, name , 31)
  set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
  new players[32], pnum
  get_players(players, pnum, "c")
  for(new i = 0; i < pnum; ++i) {
    if(g_DeathStats[players[i]] > get_gametime())
      continue
    show_hudmessage(players[i], _T(message), name)
  }
}

announceEventDef(id,const message[],C4Timer) {
  new name[32]
  get_user_name(id, name , 31)
  set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 2)
  new players[32], pnum
  get_players(players, pnum, "c")
  for(new i = 0; i < pnum; ++i) {
    if(g_DeathStats[players[i]] > get_gametime())
      continue
    show_hudmessage(players[i], _T(message), name, C4Timer)
  }
}

public eGotBomb(id) {
  g_Planter = id
  g_Defuser = g_Defusing = 0
  if(BombReached && read_data(1) == 2 && g_LastOmg < get_gametime()) {
    g_LastOmg = get_gametime() + 15.0
    announceEvent(g_Planter, "OMG! %s reached the target!")
  }
}

public eBombDefG(id) {
  if(read_data(1) == 3) {
    if(BombPlanting && g_LastPlan < get_gametime()) {
      g_LastPlan = get_gametime() + 15.0
      announceEvent(g_Planter, "%s is planting the bomb!")
    }
  }
  else {
    g_Defuser = g_Defusing = id
    if(BombDefusing && g_LastPlan < get_gametime()) {
      g_LastPlan = get_gametime() + 15.0
      announceEvent(g_Defusing, "%s is defusing the bomb...")
    }
  }
}

public eBombDefL(id) {
  g_Defusing = 0
}

public eBombPlanted() {
  if(g_C4Timer != -2) {
    if(BombPlanted) announceEvent(g_Planter, "%s set us up the bomb!!!")
    if(BombPlantedSound) play_wav("djeyl/c4powa")
    g_C4Timer = g_mp_c4timer
    set_task(1.0, "bombTimer", TASK_bombTimer)
    g_gameTime = get_gametime()
    g_LastPlan = 0.0
  }
}

public bombTimer() {
  if(--g_C4Timer > 0) {
    if(BombCountVoice) {
      if(g_C4Timer == 40 || g_C4Timer == 30 || g_C4Timer == 20) {
        new temp[64]
        num_to_word(g_C4Timer, temp, 63)
        format(temp, 63, "^"vox/%s seconds until explosion^"", temp)
        play_wav(temp)
      }
      else if(g_C4Timer < 11) {
        new temp[32]
        num_to_word(g_C4Timer, temp, 31)
        format(temp, 31, "^"vox/%s^"", temp)
        play_wav(temp)
      }
    }
    if(BombCountDef && g_Defusing) client_print(g_Defusing, print_center, "%d", g_C4Timer)
    if(BombCountHUD) {
      if(g_C4Timer < 6) set_hudmessage(150, 0, 0, -1.0, 0.78, 0, 1.0, 1.1, 0.01, 0.01, 4)
      if(g_C4Timer > 5) set_hudmessage(150, 150, 0, -1.0, 0.78, 0, 1.0, 1.1, 0.01, 0.01, 4)
      if(g_C4Timer > 10) set_hudmessage(0, 150, 0, -1.0, 0.78, 0, 1.0, 1.1, 0.01, 0.01, 4)
      new bt_ppl[32], plnum = 0
      get_players(bt_ppl, plnum, "c")
      for(new a = 0; a < plnum; ++a) {
        if(g_DeathStats[bt_ppl[a]] > get_gametime())
            continue
        show_hudmessage(bt_ppl[a], _T("C4: %ds"), g_C4Timer)
      }
    }
    new Float:gameTime = get_gametime()
    new Float:offset = gameTime - g_gameTime
    offset = offset - floatround(offset, floatround_floor)
    offset = floatround(offset*10.0, floatround_floor) / 10.0
    set_task(1.0 - offset, "bombTimer", TASK_bombTimer)
  }
}

public eBombDef() {
  if(BombDefused && (g_C4Timer >= 0)) announceEventDef(g_Defuser, "%s defused the bomb!^nC4 stopped at %d sec.", g_C4Timer)
  if(BombDefusedSound) play_wav("djeyl/laugh")
  if(g_iConnected[g_Defuser]) {
    if(g_funRunning) {
      new frags = get_user_frags(g_Defuser) - 3 + get_cvarptr_num(g_cvar_amx_bomb_frags)
      set_user_frags(g_Defuser, frags)
    }
    else if(g_vexdRunning) {
      new frags = get_user_frags(g_Defuser) - 3 + get_cvarptr_num(g_cvar_amx_bomb_frags)
      entity_set_float(g_Defuser, EV_FL_frags, float(frags))
      message_begin(MSG_ALL, g_iMsgIdScoreInfo)
      write_byte(g_Defuser)
      write_short(frags)
      write_short(get_user_deaths(g_Defuser))
      write_short(0)
      write_short(get_user_team(g_Defuser))
      message_end()
    }
  }
}

public eBombFail() {
  if(g_Defuser) {
    if(BombFailed) announceEvent(g_Defuser, "%s failed to defuse the bomb...")
    if(BombFailedSound) play_wav("djeyl/witch")
  }
  if(g_iConnected[g_Planter]) {
    if(g_funRunning) {
      new frags = get_user_frags(g_Planter) - 3 + get_cvarptr_num(g_cvar_amx_bomb_frags)
      set_user_frags(g_Planter, frags)
    }
    else if(g_vexdRunning) {
      new frags = get_user_frags(g_Planter) - 3 + get_cvarptr_num(g_cvar_amx_bomb_frags)
      entity_set_float(g_Planter, EV_FL_frags, float(frags))
      message_begin(MSG_ALL, g_iMsgIdScoreInfo)
      write_byte(g_Planter)
      write_short(frags)
      write_short(get_user_deaths(g_Planter))
      write_short(0)
      write_short(get_user_team(g_Planter))
      message_end()
    }
  }
}

public eBombPickUp(id) {
  if(BombPickUp) announceEvent(id, "%s picked up the bomb...")
}

public eBombDrop() {
  if(BombDrop) announceEvent(g_Planter, "%s dropped the bomb!!!")
}

public eResetHud(id) {
  remove_task(TASKID_showKillingStreakHud+id)

  if(g_kills[id] > 0) {
    if(KillingStreakHUD) {
      new param[8]
      param[0] = id
      param[1] = g_kills[id]
      param[2] = g_hs[id]
      param[3] = g_nade[id]
      param[4] = g_knife[id]
      param[5] = g_longestKillStreak[id]
      param[6] = g_longestDeathStreak[id]
      param[7] = 0
      set_task(get_cvarptr_float(g_cvar_mp_freezetime)+2.0, "showKillingStreakHud", TASKID_showKillingStreakHud+id, param, 8)
    }
  }
  else {
    if(KillingStreakHUD) {
      new param[4]
      param[0] = id
      param[1] = g_deaths[id]
      param[2] = g_longestKillStreak[id]
      param[3] = g_longestDeathStreak[id]
      set_task(get_cvarptr_float(g_cvar_mp_freezetime)+2.0, "showDeathStreakHud", 876543+id, param, 4)
    }
  }
}

public cmdKillingStreak(id) {
  if(!KillingStreakSay) {
    client_print(id, print_chat, _T(g_disabledMsg,id))
    return PLUGIN_HANDLED
  }
  if(KillingStreakHUD) {
    if(g_kills[id] > 0) {
      new param[8]
      param[0] = id
      param[1] = g_kills[id]
      param[2] = g_hs[id]
      param[3] = g_nade[id]
      param[4] = g_knife[id]
      param[5] = g_longestKillStreak[id]
      param[6] = g_longestDeathStreak[id]
      param[7] = 0
      showKillingStreakHud(param)
    }
    else {
      new param[4]
      param[0] = id
      param[1] = g_deaths[id]
      param[2] = g_longestKillStreak[id]
      param[3] = g_longestDeathStreak[id]
      showDeathStreakHud(param)
    }
  }
  return PLUGIN_HANDLED
}

public showKillingStreakHud(param[]) {
  new player = param[0]
  if(!g_iConnected[player])
    return
  new l_kills = param[1]
  new l_hs = param[2]
  new l_nade = param[3]
  new l_knife = param[4]
  new l_longkstreak = param[5]
  new l_longdstreak = param[6]
  new l_end = param[7]
  set_hudmessage(150, 150, 0, 0.02, 0.9, 2, 0.05, 0.1, 0.01, 6.0, 4)
  static sBuffer[256]
  new iLen = 0
  if(l_end) iLen = formatex(sBuffer, 255, _T("Your latest streak was %d %s.",player), l_kills, (l_kills != 1) ? _T("kills",player) : _T("kill",player))
  else iLen = formatex(sBuffer, 255, _T("Your current streak is %d %s.",player), l_kills, (l_kills != 1) ? _T("kills",player) : _T("kill",player))
  if(l_hs || l_nade || l_knife) {
    iLen += copy(sBuffer[iLen], 255-iLen, " (")
    if(l_hs) iLen += formatex(sBuffer[iLen], 255-iLen, "%d hs,", l_hs)
    if(l_nade) iLen += formatex(sBuffer[iLen], 255-iLen, "%d %s,", l_nade, (l_nade>1) ? _T("nades",player) : _T("nade",player))
    if(l_knife) iLen += formatex(sBuffer[iLen], 255-iLen, "%d %s,", l_knife, (l_knife>1) ? _T("knives",player) : _T("knife",player))
    iLen -= 1
    iLen += copy(sBuffer[iLen], 255-iLen, ")")
  }
  iLen += formatex(sBuffer[iLen], 255-iLen, _T("^nYour longest killstreak is %d. Your longest deathstreak is %d.",player), l_longkstreak, l_longdstreak)
  show_hudmessage(player, sBuffer)
}

public showDeathStreakHud(param[]) {
  new player = param[0]
  if(!g_iConnected[player])
    return
  new l_deaths = param[1]
  new l_longkstreak = param[2]
  new l_longdstreak = param[3]
  set_hudmessage(150, 150, 0, 0.02, 0.9, 2, 0.05, 0.1, 0.01, 6.0, 4)
  new sBuffer[128]
  formatex(sBuffer, 127, _T("Your current streak is %d %s.^nYour longest killstreak is %d. Your longest deathstreak is %d.",player), l_deaths, (l_deaths != 1) ? _T("deaths",player) : _T("death",player), l_longkstreak, l_longdstreak)
  show_hudmessage(player, sBuffer)
}

public showKillingStreakEndHud(param[]) {
  set_hudmessage(0, 150, 255, 0.73, 0.65, 2, 0.02, 8.0, 0.01, 6.0, 3)
  new l_victim = param[0]
  new l_killer = param[1]
  new l_kills = param[2]
  new l_hs = param[3]
  new l_nade = param[4]
  new l_knife = param[5]
  new l_vname[32]
  get_user_name(l_victim, l_vname, 31)
  new l_kname[32]
  get_user_name(l_killer, l_kname, 31)
  static sBuffer[256]
  new iLen = 0
  new pl[32], plnum, tempId
  get_players(pl, plnum, "c")
  for(new a = 0; a < plnum; ++a) {
    tempId = pl[a]
    iLen = formatex(sBuffer, 255, _T("%s's^nkilling spree^n%d kills",tempId), l_vname, l_kills)
    if(l_hs || l_nade || l_knife) {
      iLen += copy(sBuffer[iLen], 255-iLen, " (")
      if(l_hs) iLen += formatex(sBuffer[iLen], 255-iLen, "%d hs,", l_hs)
      if(l_nade) iLen += formatex(sBuffer[iLen], 255-iLen, "%d %s,", l_nade, (l_nade>1) ? _T("nades",tempId) : _T("nade",tempId))
      if(l_knife) iLen += formatex(sBuffer[iLen], 255-iLen, "%d %s,", l_knife, (l_knife>1) ? _T("knives",tempId) : _T("knife",tempId))
      iLen -= 1
      iLen += copy(sBuffer[iLen], 255-iLen, ")")
    }
    iLen += formatex(sBuffer[iLen], 255-iLen, _T("^nwas ended by^n%s",tempId), l_kname)
    show_hudmessage(tempId, sBuffer)
  }
  return PLUGIN_CONTINUE
}

public play_wav(const sound[]) {
  new players[32], inum, player
  get_players(players, inum, "c")
  for(new i = 0; i < inum; ++i) {
    player = players[i]
    if(g_bConnecting[player] == false) {
      client_cmd(player, "spk %s", sound)
    }
  }
}

Last edited by Elusive13; 02-03-2017 at 15:02.
Elusive13 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-03-2017 , 15:31   Re: Request for miscstats
Reply With Quote #2

You know there a tons of plugins like this for AMXX, right? Use StatsX.
__________________

Last edited by OciXCrom; 02-03-2017 at 15:31.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Elusive13
Member
Join Date: Sep 2011
Old 02-04-2017 , 05:14   Re: Request for miscstats
Reply With Quote #3

Lock! I find what i searching
Elusive13 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode