Results 1 to 10 of 29

Thread: best player map

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    If you rename a variable the result still not going to change xd Forget this script, i wrote it before you said you need 2nd and 3rd players too. I copied a link above about the insertion sort, use that to sort the players by exp. After you're ready, you have to only print (or put in cvars) the first 3 elements of the sorted array.

    EDIT: I thought you will never write the script, so:
    PHP Code:
    checkStatus()
    {
        
    level.brakdanych "^1BRAK DANYCH";
        
    places = [];
        
    places[0] = []; // 1st player
        
    places[1] = []; // 2nd player
        
    places[2] = []; // 3rd player

        
    players getEntArray("player""classname");

        
    // take invalid players from the array
        
    array = [];
        for (
    0players.sizei++)
        {
            
    player players];

            if (! 
    isDefined(player.pers["team"]) || player.pers["team"] == "spectator")
                continue;

            array[ array.
    size ] = players];
        }

        
    // sort the 'players' array by exp
        
    array = array_sort_by_exp(array);

        
    // set places
        
    for (0places.sizei++)
        {
            if (
    isDefined(array[ ])) {
                
    places]["player"]    = array[ ];
                
    places]["name"]        = array[ ].name;
                
    places]["exp"]        = array[ ].sexp;
                
    places]["rank"]        = array[ ].poziom;
            } else {
                
    places]["player"]    = undefined;
                
    places]["name"]        = level.brakdanych;
                
    places]["exp"]        = level.brakdanych;
                
    places]["rank"]        = level.brakdanych;
            }
        }

        
    // set cvars for all players
        
    for (0players.sizei++)
        {
            
    player players];

            
    player setClientCvar("first_player",
                    
    "first Player: Name:" places[0]["name"] +
                    
    " His Exp IS:" places[0]["exp"] +
                    
    " His rank IS:" places[0]["rank"]);
            
    player setClientCvar("second_player",
                    
    "second Player: Name:" places[1]["name"] +
                    
    " His Exp IS:" places[1]["exp"] +
                    
    " His rank IS:" places[1]["rank"]);
            
    player setClientCvar("third_player",
                    
    "third Player: Name:" places[2]["name"] +
                    
    " His Exp IS:" places[2]["exp"] +
                    
    " His rank IS:" places[2]["rank"]);
        }
    }

    array_sort_by_exp(array)
    {
        
    temp = array;

        for (
    0temp.size 1i++)
        {
            for (
    1temp.sizej++)
            {
                if (
    temp].sexp temp].sexp)
                {
                    var = 
    temp];
                    
    temp] = temp];
                    
    temp] = var;
                }
            }
        }

        return 
    temp;

    Last edited by randall; 13th July 2013 at 14:37.

  2. The Following User Says Thank You to randall For This Useful Post:

    NemanjA (14th July 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •