Raised This Month: $ Target: $400
 0% 

[RESOLVED]tag mismatch :(


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-01-2010 , 22:00   [RESOLVED]tag mismatch :(
Reply With Quote #1

Code:
if(get_pcvar_num(amx_ok_bb_enable))
			{
				if(killerid != Victim)
				{
					get_user_name(Victim,victimname,31)
					new healthtransfer = g_bhealth[Victim]/2
					if(healthtransfer < 1)
						healthtransfer = 1
					new healthloss = g_bhealth[Victim]/4
					if((g_bhealth[killerid] + healthtransfer) <= (get_cvar_num(amx_ok_bb_cap)))
					{
						client_print(killerid,print_chat,"[OK] You have gained %d blood supply for killing %s.",healthtransfer,victimname)
						client_print(Victim,print_chat,"[OK] You have lost %d blood supply for dying.",healthloss)
						g_bhealth[killerid] += healthtransfer
						g_bhealth[Victim] -= healthloss
					}
					else if((g_bhealth[killerid] + healthtransfer) > (get_pcvar_num(amx_ok_bb_cap)))
					{
						client_print(killerid,print_chat,"[OK] You could not gain any more Blood, because your current bank is full(%d)!",(get_cvar_num("amx_ok_bb_cap")))
					}
				}
			}
			else if(get_cvar_num("amx_ok_bb_enable") == 0)
			{
				client_print(killerid,print_chat,"[OK] No blood rewarded, because blood bank is disabled")
				
			}
		}
the variables are a global variable to store an integer, and a temp one, stated right above it, I have absolutely no clue how its mismatched or how to fix it
__________________
+|- KARMA Respectively


Last edited by HLM; 05-02-2010 at 01:44.
HLM is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-01-2010 , 22:31   Re: tag mismatch :(
Reply With Quote #2

Post whole code.
__________________
Impossible is Nothing
Sylwester is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-01-2010 , 22:38   Re: tag mismatch :(
Reply With Quote #3

Chances are that amx_ok_bb_cap is a float.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-01-2010 , 22:43   Re: tag mismatch :(
Reply With Quote #4

the whole code is 675 lines.

Code:
new g_health[33]
new g_bhealth[33]
new amx_overkill,amx_ok_perc,amx_ok_life_cap,amx_ok_max,amx_ok_reward_cap,amx_ok_perc_capped,amx_ok_ff,amx_ok_bb_cap,amx_ok_bb_enable

public plugin_init() 
{ 
	register_plugin(NAME,VERSION,AUTHOR)
	amx_overkill = register_cvar("amx_overkill","1") /* on/off var */
	amx_ok_perc = register_cvar("amx_ok_perc","100") /* starting perc */
	amx_ok_life_cap =register_cvar("amx_ok_life_cap","250") /* maximum total healt*/
	amx_ok_max = register_cvar("amx_ok_max","80") /* maximum reward per overkill 0 to disable */
	amx_ok_reward_cap = register_cvar("amx_ok_reward_cap","5") /* hp before breaking down */
	amx_ok_perc_capped = register_cvar("amx_ok_perc_capped","15") /* number to lower the perc by */
	amx_ok_ff = register_cvar("amx_ok_ff","1") /* teamkills give reward? */
	amx_ok_bb_cap = register_cvar("amx_ok_bb_cap", "5000") /* set the limit for the blood bank */
	amx_ok_bb_enable = register_cvar("amx_ok_bb_enable", "1") /* is the bank open today? */
	register_event("DeathMsg", "overkill", "a")
	
	register_clcmd("amx_bloodbank", "bb_menu", -1, "Opens the Blood Bank Menu")
	register_clcmd("say","say_help")
	register_clcmd("say_team","say_help")
	register_clcmd("setblood","set_user_blood",ADMIN_SLAY,"Sets a users bloodlevel")
	
	register_forward(FM_Touch,"hook_touch")
	
	RegisterHam(Ham_TakeDamage, "player", "fw_takedamage")
	
	return PLUGIN_CONTINUE 
}
Code:
public overkill() {
	if (!get_pcvar_num(amx_overkill))
		return PLUGIN_CONTINUE
	new killerid = read_data(1)
	new Victim = read_data(2)
	new victimname[32]
	get_user_name(Victim,victimname,31)
	if (killerid == 0)
		return PLUGIN_CONTINUE
	new deadid = read_data(2)
	//users should already connected and killer should be alive... duh.. >< just check for safety
	if (!is_user_alive(killerid) && !is_user_connected(deadid))
		return PLUGIN_CONTINUE
	//Reward if it's a teamkill?
	if (get_user_team(killerid) == get_user_team(deadid) && !get_pcvar_num(amx_ok_ff))
		return PLUGIN_CONTINUE
	g_health[deadid] = 100	
	new Float:hp = float(get_user_health(deadid) * -1)
	if (!hp)
		return PLUGIN_CONTINUE
	new Float:rewardhp,Float:temp,Float:reward_cap = float(get_pcvar_num(amx_ok_reward_cap)),Float:perc = get_pcvar_num(amx_ok_perc) / 100.0,Float:perc_capped = get_pcvar_num(amx_ok_perc_capped) / 100.0,Float:tempperc
	new inloop = 1
	
	while (inloop)
	{	
		if (hp <= reward_cap) {
			temp = hp * perc
			inloop = 0
		}
		
		else {
			temp = reward_cap * perc
			hp -= reward_cap
			
			tempperc = perc
			perc = perc - perc_capped
			//client_print(killerid,print_chat,"perc %d hp %d",perc,hp)
			if (perc < 0) {
				tempperc = perc_capped + perc
				temp += tempperc * hp
				inloop=0
				//client_print(killerid,print_chat,"in loop perc < 0 **perc=%d",perc)
			}
		}
		
		rewardhp += temp
	}
	
	new Float:maxreward = float(get_pcvar_num(amx_ok_max))
	if (maxreward)
		rewardhp = rewardhp > maxreward ? maxreward : rewardhp
	
	new Float:health = float(get_user_health(killerid))
	health += rewardhp
	
	new Float:life_cap = float(get_pcvar_num(amx_ok_life_cap))
	if (life_cap)
		health = health > life_cap ? life_cap : health
	
	if(is_user_alive(killerid))
	{
		new Float:life_cap = float(get_pcvar_num(amx_ok_life_cap))
		if(g_health[killerid] != life_cap)
		{
			g_health[killerid] = (floatround(health))
			set_user_health(killerid,floatround(health))
			client_print(killerid, print_chat, "[OK] +%dhp!",floatround(rewardhp))
			if(get_pcvar_num(amx_ok_bb_enable))
			{
				if(killerid != Victim)
				{
					get_user_name(Victim,victimname,31)
					new healthtransfer = g_bhealth[Victim]/2
					if(healthtransfer < 1)
						healthtransfer = 1
					new healthloss = g_bhealth[Victim]/4
					if((g_bhealth[killerid] + healthtransfer) <= (get_cvar_num(amx_ok_bb_cap)))
					{
						client_print(killerid,print_chat,"[OK] You have gained %d blood supply for killing %s.",healthtransfer,victimname)
						client_print(Victim,print_chat,"[OK] You have lost %d blood supply for dying.",healthloss)
						g_bhealth[killerid] += healthtransfer
						g_bhealth[Victim] -= healthloss
					}
					else if((g_bhealth[killerid] + healthtransfer) > (get_pcvar_num(amx_ok_bb_cap)))
					{
						client_print(killerid,print_chat,"[OK] You could not gain any more Blood, because your current bank is full(%d)!",(get_cvar_num("amx_ok_bb_cap")))
					}
				}
			}
			else if(get_cvar_num("amx_ok_bb_enable") == 0)
			{
				client_print(killerid,print_chat,"[OK] No blood rewarded, because blood bank is disabled")
				
			}
		}
		else if(g_health[killerid] == life_cap)
		{
			client_print(killerid,print_chat,"[OK] Could not gain any more life, you are at cap.")
		}
		
	}
	
	return PLUGIN_CONTINUE 
}
heres plugin init and the public of that code the errored line is colored again
__________________
+|- KARMA Respectively


Last edited by HLM; 05-01-2010 at 22:45.
HLM is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-01-2010 , 23:31   Re: tag mismatch :(
Reply With Quote #5

get_cvar_num -> get_pcvar_num
__________________
Impossible is Nothing
Sylwester is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-01-2010 , 23:43   Re: tag mismatch :(
Reply With Quote #6

yeah, thanks alot sylwester, now can you tell me what the difference is and when to use which?
__________________
+|- KARMA Respectively

HLM is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-02-2010 , 00:19   Re: tag mismatch :(
Reply With Quote #7

Pcvars are faster so you should prefer them in most all situations. There are at least a few topics that explain them well (probably in Scripting Help).
__________________
fysiks is offline
Reply



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 05:01.


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