Raised This Month: $ Target: $400
 0% 

Need Help Modifying a code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bcmorgue
Junior Member
Join Date: Apr 2004
Old 04-22-2004 , 14:24   Need Help Modifying a code
Reply With Quote #1

I just upgraded to AMX Mod X on my CS Server about 4 days ago, and I must say it runs way better than AMX MOD!

Thank's so much!!

Ok, here's my problem. I am trying to modify an AMXMod Plugin, that will automatically take a screen shot of your kills. I compiled it with AMX Mod X, and it works just fine, but I wanted to tweak it a bit.

The plugin takes a screen shot right when the player dies, but I wanted to change it to wait about 1/2 second after the player dies, to get a better screen shot (I run amx_gore enhancements, so the screen shots look better)

Here is the code:

Code:
/*
* Kill Cam
*  v 0.1
*
*  by ImJust2Nasty
*   [email protected]
*
* Cvars: say /killcamon - enable killcam
*	 say /killcamoff - disable killcam
* 
*/

#include <amxmod>

new kc_on[33]

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)
			client_cmd(killer_id,"snapshot")
		}
	return PLUGIN_HANDLED
}

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
}
I'm still new to scripting, so I think this would be cool learning experience in itself!

Thanks for the help!
bcmorgue is offline
Hangman5386
Member
Join Date: Mar 2004
Old 04-22-2004 , 17:37  
Reply With Quote #2

Just a tip: There's a similiar plugin here ... but it's not approved! Link
Hangman5386 is offline
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 04-22-2004 , 19:05  
Reply With Quote #3

you could ask there.
__________________
QwertyAccess is offline
GanJa
Member
Join Date: Mar 2004
Location: Salem, OR
Old 04-22-2004 , 22:07  
Reply With Quote #4

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 =)
GanJa is offline
bcmorgue
Junior Member
Join Date: Apr 2004
Old 04-23-2004 , 11:35  
Reply With Quote #5

sweet, thank you!!!!!!
__________________
Castor Troy
c/o The BC Morgue Gaming Community
http://www.bcmorgue.com
CS 1.5 24.106.36.66:27017 CS without the BS
bcmorgue 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 16:29.


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