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

Percentage


Post New Thread Reply   
 
Thread Tools Display Modes
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-11-2013 , 14:51   Re: Percentage
Reply With Quote #11

If you can't do it without knowing the previous level then why don't you just make an array containing each XP needed for each level?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Bladell
Senior Member
Join Date: Jun 2012
Old 06-11-2013 , 15:23   Re: Percentage
Reply With Quote #12

It's to much for me...I search for a method wich is more simple for me and I can understand it.I'm very curious about how do you solve this problem.I search for a solution more than one week, there is no other way, and now you come to me and you say thatt here is other way.Just give me a example,I can't sleep tonight...
Bladell is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-11-2013 , 17:38   Re: Percentage
Reply With Quote #13

You are posting in scripting help so I assume you know how to code and that you can understand what I told you in my previous post. I will not help beyond that.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-11-2013 , 18:58   Re: Percentage
Reply With Quote #14

Why can't you use:
Code:
sh_get_lvl_xp( gPlayerLevel[i] - 1 )

Last edited by Emp`; 06-11-2013 at 18:58.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Bladell
Senior Member
Join Date: Jun 2012
Old 06-12-2013 , 09:37   Re: Percentage
Reply With Quote #15

Thanks for ideea Emp`, now I'm here...
Code:
#include <superheromod>

new gPlayerLevel[33]
new gServerLevels[33]
new gRequiredXP[33]
new gPlayerXP[33]
new gReqXP[33]
new gWork
new gWork2
new gWork3
new gWork4

public plugin_init()
{
	register_plugin("Superhero show percent", "1.0", "Jelle")
	
	set_task(1.0, "get_level", _, _, _, "b")
}

public get_level( id )
{
	new players[32], playerCount
	get_players(players, playerCount, "ah")
	
	
	for ( new i = 0; i < playerCount; i++ )
	{
		gServerLevels[ id ] = sh_get_num_lvls()
		
		gPlayerLevel[i] = sh_get_user_lvl(i)
		
		if ( gPlayerLevel[i] > gServerLevels[ i ] )
		{
			gRequiredXP[i] = sh_get_lvl_xp(gPlayerLevel[i])
		}
		
		else
		{
			gRequiredXP[i] = 0
		}
		
		gPlayerXP[i] = sh_get_user_xp(i)
		gReqXP[i] = sh_get_lvl_xp( gPlayerLevel[i] - 1 )
		gWork = gRequiredXP[i] - gReqXP[i]
		gWork2 = gPlayerXP[i] - gReqXP[i]
		gWork3 = gWork2*100/gWork
		gWork4 = 100 - gWork3
		set_hudmessage( 255, 170, 0, 0.06, 0.82, 0, 6.0, 1.0 );
		show_hudmessage( id, "LVL: %d/%d %d% until next level", gPlayerLevel[ id ], gServerLevels[ id ], gWork4 );
	}
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Other advice please?
Bladell is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-12-2013 , 13:55   Re: Percentage
Reply With Quote #16

Looks fine, but there are other improvements you could do. Also, you should look into using a HudSync.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Bladell
Senior Member
Join Date: Jun 2012
Old 06-12-2013 , 16:13   Re: Percentage
Reply With Quote #17

Looks fine but not work...that's why I am here )
I can't find what's the problem...a hint would be welcome.
Bladell is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-12-2013 , 19:41   Re: Percentage
Reply With Quote #18

Code:
public get_level( )
{
	new players[32], playerCount, id
	get_players(players, playerCount, "ah")
	
	
	for ( new i = 0; i < playerCount; i++ )
	{
		id = players[i]
		//use id as the player's id, not i
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Bladell
Senior Member
Join Date: Jun 2012
Old 06-13-2013 , 05:23   Re: Percentage
Reply With Quote #19

Code:
#include <superheromod>

new gPlayerLevel[33]
new gServerLevels[33]
new gRequiredXP[33]
new gPlayerXP[33]
new gReqXP[33]
new gWork
new gWork2
new gWork3
new gWork4

public plugin_init()
{
	register_plugin("Superhero show percent", "1.0", "Jelle")
	
	set_task(1.0, "get_level", _, _, _, "b")
}

public get_level( id )
{
	new players[32], playerCount
	get_players(players, playerCount, "ah")
	
	for ( new i = 0; i < playerCount; i++ )
	{
		id = players[i]
		gServerLevels[ id ] = sh_get_num_lvls()
		
		gPlayerLevel[i] = sh_get_user_lvl(i)
		
		if ( gPlayerLevel[i] > gServerLevels[ i ] )
		{
			gRequiredXP[i] = sh_get_lvl_xp(gPlayerLevel[i])
		}
		
		else
		{
			gRequiredXP[i] = 0
		}
		
		gPlayerXP[i] = sh_get_user_xp(i)
		gReqXP[i] = sh_get_lvl_xp( gPlayerLevel[i] - 1 )
		gWork = gRequiredXP[i] - gReqXP[i]
		gWork2 = gPlayerXP[i] - gReqXP[i]
		gWork3 = gWork2*100/gWork
		gWork4 = 100 - gWork3
		set_hudmessage( 255, 170, 0, 0.06, 0.82, 0, 6.0, 1.0 );
		show_hudmessage( id, "LVL: %d/%d %d% until next level", gPlayerLevel[ id ], gServerLevels[ id ], gWork4 );
	}
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Still not work
Bladell is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-13-2013 , 20:32   Re: Percentage
Reply With Quote #20

Quote:
Originally Posted by Emp` View Post
Code:
		//use id as the player's id, not i
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 17:00.


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