Code:
/*
* Kill Cam
* v 0.1
*
* by ImJust2Nasty
* <a href="mailto:[email protected]">[email protected]</a>
*
* Cvars: say /killcamon - enable killcam
* say /killcamoff - disable killcam
*
*/
#include <amxmod>
new kc_on
[33]
new thekiller
public kill_event
() {
new kname
[32]
new killer_id
= read_data(1)
new victim_id
= read_data(2)
if (kc_on
[killer_id
] == 1)
if (killer_id
!= victim_id
&& killer_id
)
{
get_user_name(killer_id,kname,
31)
new kcmsg
[128], kclol
[128]
format(kcmsg,
127,
"Killcam took snapshot")
format(kclol,
127,
"%s took a pic of your death",kname
)
set_hudmessage(255,
255,
0,
0.02,
0.9,
2,
0.02,
10.0,
0.01,
0.1,
2)
show_hudmessage(killer_id,kcmsg
)
show_hudmessage(victim_id,kclol
)
thekiller
=killer_id
set_task(0.5,
"take_the_shot",
0,
"",
0,
"")
}
return PLUGIN_HANDLED
}
public take_the_shot
() {
client_cmd(thekiller,
"snapshot")
}
public kcon
(id
) {
new kcmsgon
[128]
kc_on
[id
] = 1
format(kcmsgon,
127,
"Killcam is on")
set_hudmessage(255,
255,
0,
0.02,
0.9,
2,
0.02,
10.0,
0.01,
0.1,
2)
show_hudmessage(id,kcmsgon
)
}
public kcoff
(id
) {
new kcmsgoff
[128]
kc_on
[id
] = 0
format(kcmsgoff,
127,
"Killcam is off")
set_hudmessage(255,
255,
0,
0.02,
0.9,
2,
0.02,
10.0,
0.01,
0.1,
2)
show_hudmessage(id,kcmsgoff
)
}
public client_connect
(id
){
kc_on
[id
] = 0
return PLUGIN_CONTINUE
}
public plugin_init
(){
register_plugin("KillCam",
"0.1",
"ImJust2Nasty")
register_event("DeathMsg",
"kill_event",
"a")
register_clcmd("say /killcamon",
"kcon",
0,
"- enable killcam")
register_clcmd("say /killcamoff",
"kcoff",
0,
"- disable killcam")
return PLUGIN_CONTINUE
}
Take note there is a better way to do this as in passing a var into the settask but atm I can't member how to do so =)