AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   rank player from variable (https://forums.alliedmods.net/showthread.php?t=155669)

funfel 04-25-2011 06:56

rank player from variable
 
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

reinert 04-25-2011 07:59

Re: rank player from variable
 
So where is ur problem ? because the sample message is right.

funfel 04-25-2011 09:39

Re: rank player from variable
 
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]);

Bugsy 04-25-2011 16:50

Re: rank player from variable
 
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]); 


funfel 04-25-2011 17:12

Re: rank player from variable
 
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]);

Bugsy 04-25-2011 17:22

Re: rank player from variable
 
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.

funfel 04-25-2011 18:00

Re: rank player from variable
 
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?

Bugsy 04-25-2011 18:13

Re: rank player from variable
 
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

funfel 04-25-2011 18:41

Re: rank player from variable
 
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? : /


All times are GMT -4. The time now is 20:09.

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