Raised This Month: $ Target: $400
 0% 

rank player from variable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
funfel
Member
Join Date: Apr 2011
Old 04-25-2011 , 06:56   rank player from variable
Reply With Quote #1

Hi, I have a problem, because I'm trying to make a player's rating, which would be created on the basis of variable giExperience. I save giExperience in nvault. How can I do?

Sample message: client_print(id, print_chat, "Your rank is %d/%d (You have %d experience)", gPlayerRank[id], gMaxPlayersOfRank, giExperience[id]);

sorry for my English because it is weak, and thank you for your help: D

Last edited by funfel; 04-25-2011 at 07:01.
funfel is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 04-25-2011 , 07:59   Re: rank player from variable
Reply With Quote #2

So where is ur problem ? because the sample message is right.
reinert is offline
funfel
Member
Join Date: Apr 2011
Old 04-25-2011 , 09:39   Re: rank player from variable
Reply With Quote #3

I know just how to figure out which player is ranked (position is based on that experience) and it's probably gMaxPlayersOfRank get_statsnum () but I'm not sure.

Sample:
gMaxPlayersOfRank = get_statsnum();
gPlayerRank[id] = /* I can not do that */
client_print(id, print_chat, "Your rank is %d/%d (You have %d experience)", gPlayerRank[id], gMaxPlayersOfRank, giExperience[id]);
funfel is offline
Old 04-25-2011, 14:30
funfel
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2011 , 16:50   Re: rank player from variable
Reply With Quote #4

untested
PHP Code:

new iStats] , iBHits];

gMaxPlayersOfRank get_statsnum(); 
gPlayerRank[id] = get_user_statsid iStats iBHits );

client_print(idprint_chat"Your rank is %d/%d (You have %d experience)"iRankgMaxPlayersOfRankgiExperience[id]); 
__________________

Last edited by Bugsy; 04-25-2011 at 17:20.
Bugsy is offline
funfel
Member
Join Date: Apr 2011
Old 04-25-2011 , 17:12   Re: rank player from variable
Reply With Quote #5

get_user_stats only for kills and deaths

from csstats.inc:

/* Gets overall stats which are stored in file on server
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
native get_user_stats(index,stats[8],bodyhits[8]);
funfel is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2011 , 17:22   Re: rank player from variable
Reply With Quote #6

Thats how stats works, based on kills/deaths which is what I figured you were using since you used get_statsnum() which is based off of the same ranking system.

get_user_stats()
Gets overall stats which are stored in file on server and updated on every respawn or user disconnect. Function returns the position in stats by differece in kills to deaths.

Position = rank.

If you want to make your own ranking system with your own calculations you will need to do the math and then sort the list of players.

I edited my post above with code.
__________________

Last edited by Bugsy; 04-25-2011 at 17:54.
Bugsy is offline
funfel
Member
Join Date: Apr 2011
Old 04-25-2011 , 18:00   Re: rank player from variable
Reply With Quote #7

That math is going to be easy, but I do not know how to sort the players.
You can try to do loops:
for (new id = 0; id <get_statsnum (), id + +)
What do you think?
funfel is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2011 , 18:13   Re: rank player from variable
Reply With Quote #8

Why are you using get_statsnum though if you are using your own ranking system?

I would store each players stats in vault and then read all entries into an array then sort using SortCustom2D
__________________
Bugsy is offline
funfel
Member
Join Date: Apr 2011
Old 04-25-2011 , 18:41   Re: rank player from variable
Reply With Quote #9

Sorry but I do not know how to do it so i am really noob :<

edit: Could you do it or start? I try to finish.

Exolent or xPaw you have any ideas? : /

Last edited by funfel; 04-26-2011 at 09:53.
funfel 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 20:09.


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