Hi guys!
I have got this plugin from somewhere what I exactly don't remember.
This is a knife kill bonus plugin.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <colorchat>
#include <fun>
#define PLUGIN "Knife Kill Bonus"
#define VERSION "1.1"
#define AUTHOR "Unknown"
#define CustomSound "sound/knifekill.mp3"
const TASK_ID = 700
const Float:FAST_SPEED = 480.0 //Your speed bonus
new const g_szSound[] = "knifekill.mp3"
new g_iSync
new bool:g_bHasSpeed[75]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "onDeathMsgEvent", "a")
register_event("CurWeapon", "onCurWeaponEvent", "be", "1=1")
g_iSync = CreateHudSyncObj()
}
public plugin_precache()
precache_sound(g_szSound)
public onDeathMsgEvent()
{
new id = read_data(1)
new szWeapon[32]
read_data(4, szWeapon, charsmax(szWeapon))
if(equal(szWeapon, "knife") && is_user_alive(id))
{
new szName[32], szName2[32]
get_user_name(id, szName, charsmax(szName))
get_user_name(read_data(2), szName2, charsmax(szName2))
set_hudmessage(255, 0, 0, 0.02, 0.2, 1, 0.1, 6.0, 0.1, 0.1, -1)
ColorChat(id, print_chat, "^4[AMXX] Knife ^3%s ^4knived ^3%s ^4and got^3 10HP + 15 Sec Speed ", szName, szName2)
set_hudmessage(255, 0, 0, 0.02, 0.2, 1, 0.1, 6.0, 0.1, 0.1, -1)
ShowSyncHudMsg(0, g_iSync, "Player %s knifed %s Hahahaha", szName, szName2)
/*client_cmd(id, "mp3 play %s", g_szSound)*/
//client_cmd(id, "mp3 play %s", CustomSound)
client_cmd(0,"spk knifekill.mp3")
set_user_health(id, get_user_health( id ) + 10 )
g_bHasSpeed[id] = true
remove_task(id + TASK_ID)
set_task(15.0, "taskRemoveSpeed", id + TASK_ID)
set_user_maxspeed(id, FAST_SPEED)
set_user_frags( id, get_user_frags( id ) + 1 )
}
}
public onCurWeaponEvent(id)
if(g_bHasSpeed[id])
set_user_maxspeed(id, FAST_SPEED)
public taskRemoveSpeed(id)
{
id -= TASK_ID
g_bHasSpeed[id] = false
set_user_maxspeed(id, 260.0)
}
I have some question about this plugin. First of all, this plugin makes sound in local system only. I want that if someone knife someone, sound must be for everyone even dead or alive in the server.
And the last thing I want it to choose a random song from my list of songs on each knife kill.
Thank you, this time I want to do it myself, so please guide me how can I do it.
__________________