Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin

dod_meleebonus

by Tank · 2008-11-22 · 2 replies · 822 views · 22 downloads

Read the thread (3 posts)

From the first post

ok, this is what I did. I took FireStorm's/Diamond-Optics dod_meleebonus and combined it with a plugin I created for my server (it's not my idea but since the original plugin got lost (at least I couldn't find it anymore) I figured I rewrite it from the original idea).
rn
rnThis plugin does what dod_meleebonus does but also changes the players score after a pcvar set amount of melee kills. The plugin works perfect for me (Linux, 1.19/1.81). I want to share this plugin/update with the community but before I ask Diamond-Optic (it's based on his plugin) to post it, I need to have this fixed...
rn
rnThe problem is this:
rn
rn
client_print(0,print_chat,"[Melee Bonus] %s changed his score (+1 k's, -2d's) with 4 melee kills!",temp_player_name)

rn
rnI know how to change plugins but someone else might not. I've seen in D-O's ejaculate v1.1 he had a pcvar message and I wanted to do the same with this message...but all attempts failed. So perhaps someone could help me?
rn
rnBtw, if you see any other errors or perhaps ways which could work better, please point them out as Im only trying to learn.
rn
rnPs: D-O, you might see some changes in cvar names, these will be changed back when it's done.
rn
rn
#include rn#include rn#include rn#include rnrn#define VERSION "1.0"rn#define SVERSION "v1.0 - by diamond-optic (www.AvaMods.com)"rnrnnew killername[32]rnnew player_melee_kills[33][1]rnnew temp_player_name[33]rnrnnew p_enabled, p_givehealth, p_changedeaths, p_changekills, p_amountmeleernrnpublic plugin_init()rn{rn	register_plugin("DoD Melee Bonus",VERSION,"AMXX DoD Team")rn	register_cvar("dod_meleebonus_stats",SVERSION,FCVAR_SERVER|FCVAR_SPONLY)rn	rn	p_enabled = register_cvar("activate_plugin","1")rn	p_givehealth = register_cvar("meleebonus_hp","25")rn	p_changedeaths = register_cvar("melee_deaths","2")rn	p_changekills = register_cvar("melee_kills","1")rn	p_amountmelee = register_cvar("melee_amount","4")rn}rnrnpublic client_death(killer,victim,wpnindex,hitplace,TA) rn{rn	if(get_pcvar_num(p_enabled) && is_user_connected(killer) && is_user_alive(killer) && !TA)rn	{rn		if(wpnindex == 1 || wpnindex == 2 || wpnindex == 19 || wpnindex == 34 || wpnindex == 37 || wpnindex == 38 || wpnindex == 39 || wpnindex == 41)rn		{rn			get_user_name(killer,killername,31)rn			new addition = get_pcvar_num(p_givehealth)rn			rn			set_user_health(killer,(get_user_health(killer)+addition))rn			rn			client_print(0,print_chat,"[Melee Bonus] %s received an additional %dhp for a melee kill!",killername,addition)rn			rn			set_hudmessage(36,39,192,-1.0,0.9,0,6.0,4.0,0.1,0.2,-1)rn			show_hudmessage(killer,"+%dhp",addition)rn			rn			player_melee_kills[killer][0] = player_melee_kills[killer][0] + 1rn			if(player_melee_kills[killer][0] == get_pcvar_num(p_amountmelee))rn			{rn				dod_set_pl_deaths(killer,dod_get_pl_deaths(killer) - get_pcvar_num(p_changedeaths),1)rn				rn				if(dod_get_pl_deaths(killer) < 0)rn				{rn					dod_set_pl_deaths(killer,0,1)rn				}rn				rn				dod_set_user_kills(killer,dod_get_user_kills(killer) + get_pcvar_num(p_changekills),1)rn					rn				get_user_name(killer,temp_player_name,32)rn				client_print(0,print_chat,"[Melee Bonus] %s changed his score (+1 k's, -2d's) with 4 melee kills!",temp_player_name)rn					rn				player_melee_kills[killer][0] = 0rn			}rn		}rn	}rn	return PLUGIN_HANDLEDrn}rnrnpublic client_connect(id)rn{rn	 player_melee_kills[id][0] = 0rn}

Files

dod_meleebonus.sma Plugin Source 2 KB 22 dl Download Compile

Archived builds from the server loose

These compiled builds sat loose in the server's script folder rather than attached to a post. They are matched to this release by comparing their decompiled Pawn against the source published above, so treat the attribution as strong but not certain. Versions come from the register_plugin() call recovered from the bytecode.

dod_meleebonus.sma v0.5beta 1 KB Download Compile
dod_meleebonus_333.sma v0.5beta 1 KB Download Compile
dod_meleebonus_531.sma v0.6beta 3 KB Download Compile
dod_meleebonus_677.sma v0.6beta 3 KB Download Compile

The thread

All 3 posts from 2 people on dod_meleebonus, kept as they were written.

Tank
started this thread
Posts: 581
Threads: 59
Joined: Jan 2007
11-22-2008, 04:55 PM #1

ok, this is what I did. I took FireStorm's/Diamond-Optics dod_meleebonus and combined it with a plugin I created for my server (it's not my idea but since the original plugin got lost (at least I couldn't find it anymore) I figured I rewrite it from the original idea).rnrnThis plugin does what dod_meleebonus does but also changes the players score after a pcvar set amount of melee kills. The plugin works perfect for me (Linux, 1.19/1.81). I want to share this plugin/update with the community but before I ask Diamond-Optic (it's based on his plugin) to post it, I need to have this fixed...rnrnThe problem is this:rnrn

client_print(0,print_chat,"[Melee Bonus] %s changed his score (+1 k's, -2d's) with 4 melee kills!",temp_player_name)
rnrnI know how to change plugins but someone else might not. I've seen in D-O's ejaculate v1.1 he had a pcvar message and I wanted to do the same with this message...but all attempts failed. So perhaps someone could help me?rnrnBtw, if you see any other errors or perhaps ways which could work better, please point them out as Im only trying to learn.rnrnPs: D-O, you might see some changes in cvar names, these will be changed back when it's done.rnrn
#include <amxmodx>rn#include <dodfun>rn#include <dodx>rn#include <fun>rnrn#define VERSION "1.0"rn#define SVERSION "v1.0 - by diamond-optic (www.AvaMods.com)"rnrnnew killername[32]rnnew player_melee_kills[33][1]rnnew temp_player_name[33]rnrnnew p_enabled, p_givehealth, p_changedeaths, p_changekills, p_amountmeleernrnpublic plugin_init()rn{rn	register_plugin("DoD Melee Bonus",VERSION,"AMXX DoD Team")rn	register_cvar("dod_meleebonus_stats",SVERSION,FCVAR_SERVER|FCVAR_SPONLY)rn	rn	p_enabled = register_cvar("activate_plugin","1")rn	p_givehealth = register_cvar("meleebonus_hp","25")rn	p_changedeaths = register_cvar("melee_deaths","2")rn	p_changekills = register_cvar("melee_kills","1")rn	p_amountmelee = register_cvar("melee_amount","4")rn}rnrnpublic client_death(killer,victim,wpnindex,hitplace,TA) rn{rn	if(get_pcvar_num(p_enabled) && is_user_connected(killer) && is_user_alive(killer) && !TA)rn	{rn		if(wpnindex == 1 || wpnindex == 2 || wpnindex == 19 || wpnindex == 34 || wpnindex == 37 || wpnindex == 38 || wpnindex == 39 || wpnindex == 41)rn		{rn			get_user_name(killer,killername,31)rn			new addition = get_pcvar_num(p_givehealth)rn			rn			set_user_health(killer,(get_user_health(killer)+addition))rn			rn			client_print(0,print_chat,"[Melee Bonus] %s received an additional %dhp for a melee kill!",killername,addition)rn			rn			set_hudmessage(36,39,192,-1.0,0.9,0,6.0,4.0,0.1,0.2,-1)rn			show_hudmessage(killer,"+%dhp",addition)rn			rn			player_melee_kills[killer][0] = player_melee_kills[killer][0] + 1rn			if(player_melee_kills[killer][0] == get_pcvar_num(p_amountmelee))rn			{rn				dod_set_pl_deaths(killer,dod_get_pl_deaths(killer) - get_pcvar_num(p_changedeaths),1)rn				rn				if(dod_get_pl_deaths(killer) < 0)rn				{rn					dod_set_pl_deaths(killer,0,1)rn				}rn				rn				dod_set_user_kills(killer,dod_get_user_kills(killer) + get_pcvar_num(p_changekills),1)rn					rn				get_user_name(killer,temp_player_name,32)rn				client_print(0,print_chat,"[Melee Bonus] %s changed his score (+1 k's, -2d's) with 4 melee kills!",temp_player_name)rn					rn				player_melee_kills[killer][0] = 0rn			}rn		}rn	}rn	return PLUGIN_HANDLEDrn}rnrnpublic client_connect(id)rn{rn	 player_melee_kills[id][0] = 0rn}rn
Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
11-29-2008, 10:50 PM #2

Try this basicly i just did as D-O did in his version + I made %d to p_changekills but i dont know how to add more then one of them lol.. See the next line where its ignored that didnt work :)rnrnBtw whats is the last part doing?rnrn

	return PLUGIN_HANDLEDrn}rnrnpublic client_connect(id)rn{rn	player_melee_kills[id][0] = 0rn}rn
rnrnrn
#include <amxmodx>rn#include <dodfun>rn#include <dodx>rn#include <fun>rnrn#define VERSION "1.0"rn#define SVERSION "v1.0 - by diamond-optic (www.AvaMods.com)"rnrnnew killername[32]rnnew player_melee_kills[33][1]rnrnnew p_enabled, p_givehealth, p_changedeaths, p_changekills, p_amountmeleernrnpublic plugin_init()rn{rn	register_plugin("DoD Melee Bonus",VERSION,"AMXX DoD Team")rn	register_cvar("dod_meleebonus_stats",SVERSION,FCVAR_SERVER|FCVAR_SPONLY)rn	rn	p_enabled = register_cvar("activate_plugin","1")rn	p_givehealth = register_cvar("meleebonus_hp","25")rn	p_changedeaths = register_cvar("melee_deaths","2")rn	p_changekills = register_cvar("melee_kills","1")rn	p_amountmelee = register_cvar("melee_amount","4")rn}rnrnpublic client_death(killer,victim,wpnindex,hitplace,TA) rn{rn	if(get_pcvar_num(p_enabled) && is_user_connected(killer) && is_user_alive(killer) && !TA)rn	{rn		if(wpnindex == 1 || wpnindex == 2 || wpnindex == 19 || wpnindex == 34 || wpnindex == 37 || wpnindex == 38 || wpnindex == 39 || wpnindex == 41)rn		{rn			get_user_name(killer,killername,31)rn			new addition = get_pcvar_num(p_givehealth)rn			rn			set_user_health(killer,(get_user_health(killer)+addition))rn			rn			client_print(0,print_chat,"[Melee Bonus] %s received an additional %dhp for a melee kill!",killername,addition)rn			rn			set_hudmessage(36,39,192,-1.0,0.9,0,6.0,4.0,0.1,0.2,-1)rn			show_hudmessage(killer,"+%dhp",addition)rn			rn			player_melee_kills[killer][0] = player_melee_kills[killer][0] + 1rn			if(player_melee_kills[killer][0] == get_pcvar_num(p_amountmelee))rn			{rn				dod_set_pl_deaths(killer,dod_get_pl_deaths(killer) - get_pcvar_num(p_changedeaths),1)rn				rn				if(dod_get_pl_deaths(killer) < 0)rn				{rn					dod_set_pl_deaths(killer,0,1)rn				}rn				dod_set_user_kills(killer,dod_get_user_kills(killer) + get_pcvar_num(p_changekills),1)rn				static killername[32]rn				get_user_name(killer,killername,31)rn				client_print(0,print_chat,"[Melee Bonus] %s changed his score (+%d kills, -2 death's) with 4 melee kills!",killername, get_pcvar_num(p_changekills))rn				// Test didnt work client_print(0,print_chat,"[Melee Bonus] %s changed his score (+%d kills, -%d death's) with 4 melee kills!",killername, get_pcvar_num(p_changekills), get_pvar_num(p_changedeaths), get_pcvar_num(p_amountmelee))));rn				player_melee_kills[killer][0] = 0rn			}rn		}rn	}rn	return PLUGIN_HANDLED //not sure what this part does... cant see its nedded.... D-O didnt use it eitherrn}rnrnpublic client_connect(id)rn{rn	player_melee_kills[id][0] = 0rn}rn
rnrnAnd another thing i DIDNT test it...

Tank
started this thread
Posts: 581
Threads: 59
Joined: Jan 2007
11-30-2008, 09:13 AM #3
rnrn    return PLUGIN_HANDLEDrnrn}rnrnrnrnpublic client_connect(id)rnrn{rnrn    player_melee_kills[id][0] = 0rnrn} rn
rnrnEverytime when a player makes a melee kill, their ID get linked with that melee kill in an array. The moment the amount of melee kills reach the pcvar set, it will change the score.rnrnWhat that last part does it make sure that the ID in the array is empty. Otherwise one player disconnects, the other connects and will take over the last person's melee amount. Why I am using it and D-O doesn't is because his version just gives you HP for your melee kills, I also give the player a score adjustment.rnrnI'll play with it some more. Thanks for the help, much appriciated.

DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC