lol feel free to make fun of my code or to change it and tell me what i did wrong.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
new bool:DamageDone
new bool:FirstDeathDone
new const FirstDamageSound[] = "sounds/FirstDamage.mp3"
new const KnifeDeathSound[] = "sounds/Idiot.mp3"
new const AdminDieSound[] = "sounds/Wtf.mp3"
new const FreezeTimeEndSound[] = "sounds/Num1.mp3"
new const DisconnectSound[] = "sounds/Mario.mp3"
new const FirstDeathSound[] = "sounds/Kenny.mp3"
new const AdminDieSound3[] = "sounds/Pray.mp3"
new const AdminDieSound5[] = "sounds/Bendover.mp3"
new const 3KillInRowSound[] = "sounds/KickAss.mp3"
public plugin_precache() {
precache_generic(FirstDamageSound)
precache_generic(KnifeDeathSound)
precache_generic(AdminDieSound)
precache_generic(FreezeTimeEndSound)
precache_generic(DisconnectSound)
precache_generic(FirstDeathSound)
precache_generic(AdminDieSound3)
precache_generic(AdminDieSound5)
precache_generic(3KillInRowSound)
}
public plugin_init() {
register_plugin("test", "test", "test")
register_event("HLTV", "newround", "a", "1=0", "2=0")
register_event("Damage", "FirstDamage", "a")
register_event("DeathMsg", "Death", "a", "1>0")
register_event("DeathMsg", "AdminDie", "b")
register_logevent("logevent_round_start", 2, "1=Round_Start")
}
public newround(id) { //sets variables that control first_damage, and first_death sounds to false
DamageDone = false
FirstDeathDone = false
}
public FirstDamage(id) { //is called whenever dmaage is dealt
if (DamageDone == false) {//checks if damage has been done already
client_cmd(0, "mp3 play %s", FirstDamageSound) //plays first damage sound
DamageDone = true //makes sure this only happens on first damage (per round)
}
}
public Death() { //is called upon death of anyone
new WeaponName[20]
new WeaponID = get_weaponid(WeaponName)
read_data(4, WeaponName, 19)
if(WeaponID == CSW_KNIFE) { //checks if Death was result of knife
client_cmd(0, "mp3 play %s", KnifeDeathSound) //plays knife death sound
}
else if(FirstDeathDone == false) { //if death wasnt result of knife, and is first death continues
client_cmd(0, "mp3 play %s", FirstDeathSound) //plays First death sound
FirstDeathDone = true //makes sure only plays first death sound once per round
}
}
public AdminDie(id, level, cid) { //is called upon death of anyone
new Victim = read_data(2) //get victim's ID
if(access(Victim, ADMIN_LEVEL_B)) { //checks access level of the victim
client_cmd(0, "mp3 play %s", AdminDieSound) //plays Admin death sound
}
}
public logevent_round_start() { //is called at end of freeze time
client_cmd(0, "mp3 play %s", FreezeTimeEndSound) //plays freeze time end sound
}
public client_disconnect(id) { //is called when someone disconnects
client_cmd(0, "mp3 play %s", DisconnectSound) //plays disconnect sound
}
just ignore the 3kill in row, and admin die 3 and admindie5 sounds havent made those yet.