Raised This Month: $51 Target: $400
 12% 

get_user_frags() always returns 33


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xEhsaan
Member
Join Date: Mar 2015
Location: Isfahan, Iran
Old 03-25-2015 , 16:02   get_user_frags() always returns 33
Reply With Quote #1

Hi, I have a problem with get_user_frags() function, it always returns 33, and I don't know what am I doing wrong.
Here is the code:
Code:
public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event( "DeathMsg", "Died_Player", "a" )
}

public Died_Player() {
	new Killer = read_data( 1 )
	new Victim = read_data( 2 )
	new Headshot = read_data( 3 )
	new Weapon[32]
	read_data( 4, Weapon, 31 )
	new KillerN[32]
	get_user_name( Killer, KillerN, 32 )
	new KillerFrags, VictimFrags
	
	KillerFrags = get_user_frags(Killer)
	VictimFrags = get_user_frags(Victim)
	
	client_print_color( Killer, print_chat, "!t[Special Prize] !nFrag-e Shoma: !g%d", KillerFrags )
	client_print_color( Killer, print_chat, "!t[Special Prize] !nFrag-e Morde Niaz Baraye Jayeze: !g%d", GetRemainingFrags( KillerFrags ) )
}
Thanks :X
xEhsaan is offline
Send a message via Skype™ to xEhsaan
SuperMan1337
Junior Member
Join Date: Mar 2015
Location: Home
Old 03-25-2015 , 16:47   Re: get_user_frags() always returns 33
Reply With Quote #2

I need to see the whole code to help you

Last edited by SuperMan1337; 03-25-2015 at 16:53.
SuperMan1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-25-2015 , 18:03   Re: get_user_frags() always returns 33
Reply With Quote #3

What is returning 33, get_user_frags() or GetRemainingFrags( KillerFrags )? You should put a condition in to not fire if killer is world (id=0) ; "1>0".
__________________

Last edited by Bugsy; 03-25-2015 at 18:06.
Bugsy is offline
xEhsaan
Member
Join Date: Mar 2015
Location: Isfahan, Iran
Old 03-26-2015 , 01:51   Re: get_user_frags() always returns 33
Reply With Quote #4

OK, I found the mistake. I have a function called client_print_color() that prints colorful,
when I'm using %d , it's going to be double formatted, so that function goes 33 on it.

So changed the code to this:
Code:
new message1[191], message2[191]
	
	format( message1, 191, "!t[Special Prize] !nFrag Shoma: %d", KillerFrags )
	if ( KillerFrags < 300 )
		format( message2, 191, "!t[Special Prize] !nFrag Morde Niaz Ta Jayeze: %d", GetRemainingFrags(KillerFrags) )
	
	client_print_color( Killer, print_chat, message1 )
	client_print_color( Killer, print_chat, message2 )
Thanks guys, you're awesome ;)
xEhsaan is offline
Send a message via Skype™ to xEhsaan
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 16:11.


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