AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to find out the first player in score tab? (https://forums.alliedmods.net/showthread.php?t=309719)

LemoNSK 08-05-2018 01:03

How to find out the first player in score tab?
 
Hello, I wanted to ask how I am supposed to find out first player in the score tab? 'Cause I am making Improved Team Transfer. I want to find first player with the most score in the tab and replace him with the last one in the other team.

shauli 08-05-2018 05:41

Re: How to find out the first player in score tab?
 
Use get_players and then loop through all the players to find out which one has the highest get_user_frags. If two or more players are tied used cs_get_user_deaths as a tie-breaker.

Also bear in mind that the first player on the scoreboard isn't always the best one, a guy with 40 kills and 40 deaths will be 1st and a guy with 38 kills and 2 deaths will be 2nd.

Relaxing 08-05-2018 06:17

Re: How to find out the first player in score tab?
 
You gotta use get_players twice for both two teams.

LemoNSK 08-05-2018 06:35

Re: How to find out the first player in score tab?
 
Quote:

Originally Posted by Relaxing (Post 2608243)
You gotta use get_players twice for both two teams.

Can you give me a small example for this? I would use this command to store how many players there are in each team. Yea, so basically how am I supposed to find the one with the most frags and the one with the lowest one?

OciXCrom 08-05-2018 07:57

Re: How to find out the first player in score tab?
 
get_players + SortCustom1D

You can search for examples, there are many.

LemoNSK 08-05-2018 14:36

Re: How to find out the first player in score tab?
 
Quote:

Originally Posted by OciXCrom (Post 2608261)
get_players + SortCustom1D

You can search for examples, there are many.


Still don't understand after some checking.. someone help.

OciXCrom 08-05-2018 14:43

Re: How to find out the first player in score tab?
 
Try to do it and post the code that you wrote so far. This is the scripting section, so provide your script.

LemoNSK 08-05-2018 15:12

Re: How to find out the first player in score tab?
 
Quote:

Originally Posted by OciXCrom (Post 2608359)
Try to do it and post the code that you wrote so far. This is the scripting section, so provide your script.

PHP Code:

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_logevent("round_end"2"1=Round_End");
}


public 
round_end(id) {
      
    new 
players[MAX_PLAYERS];
    static 
numTnumCT;
    
    
get_players(playersnumT"ceh","TERRORIST");
    
get_players(playersnumCT"ceh","CT");
    


This is what I have.. Can't move from here.. So I have actually how many players there are on the server in each team, I thought of making some loop through them so I could find the players with most kills. But it makes no sense to me, there must be some command.

edon1337 08-05-2018 15:31

Re: How to find out the first player in score tab?
 
Quote:

Originally Posted by LemoNSK (Post 2608373)
PHP Code:

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_logevent("round_end"2"1=Round_End");
}


public 
round_end(id) {
      
    new 
players[MAX_PLAYERS];
    static 
numTnumCT;
    
    
get_players(playersnumT"ceh","TERRORIST");
    
get_players(playersnumCT"ceh","CT");
    


This is what I have.. Can't move from here.. So I have actually how many players there are on the server in each team, I thought of making some loop through them so I could find the players with most kills. But it makes no sense to me, there must be some command.

Well, that's the least you can do. Also don't use static on such things.

LemoNSK 08-05-2018 15:40

Re: How to find out the first player in score tab?
 
Quote:

Originally Posted by edon1337 (Post 2608383)
Well, that's the least you can do. Also don't use static on such things.

Ah... thank you for your help lol


All times are GMT -4. The time now is 12:35.

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