Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: FULL TopPos with overtaking

  1. #1
    Private Paho's Avatar
    Join Date
    Feb 2014
    Location
    Russia
    Posts
    101
    Thanks
    43
    Thanked 48 Times in 37 Posts

    Question FULL TopPos with overtaking

    zom.gsc CallbackKilled:
    if(attacker.position>1)
    attacker thread scripts\top::kilstat();
    PHP Code:
    init() {
        
    precacheString( & "^4Т^7воя ^4н^7овая ^4п^7озиция^2:^2");
        
    precacheString( & "^4Y^7our ^4n^7ew ^4p^7osition^2:^2");
    }

    onPlayerConnecting() //read all stats when a player connected
    {
        
    self.killplayers self.stats["killszom"];
        if (
    self.killplayers == 0) {
            
    sql "SELECT killszom FROM `Accounts`";
            
    mysql_query(level.mysqlsql);
            
    result mysql_store_result(level.mysql);
            
    self.position mysql_num_rows(result); //how many positions
            
    self scripts_mysql::mysql_write();
        } else {
            
    self.position self.stats["toppos"];
        }
    }

    kilstat() //when a zombie killing
    {
        
    self.position self.stats["toppos"];
        
    statik1 int(self.position 1);
        
    sql "SELECT killszom, login FROM `Accounts` WHERE `toppos`='" statik1 "'"//position to know where to make a request to find out how many kills the player below us
        
    mysql_query(level.mysqlsql);
        
    result mysql_store_result(level.mysql);
        
    row mysql_fetch_row(result);
        
    ab int(row[0]); //kills below us Player
        
    ba row[1]; //login below us Player
        
    if (self.killplayers ab//if the player's previous kills more kills in the top, then go ahead
        
    {
            
    statik2 int(self.position);
            
    sql "UPDATE `Accounts` SET " +
                
    "toppos='" statik2 "' " +
                
    "WHERE login='" ba "'"//up, who have overtaken, we give him our position
            
    mysql_query(level.mysqlsql);
            
    player self;
            
    players getEntArray("player""classname");
            for (
    0players.sizex++) {
                if (
    players[x].pers["loginname"] == ba//if the one overtaken - online? - Write it in a variable position, and say that it surpassed
                
    {
                    
    players[x].position self.position;
                    
    players[xiprintlnbold("Have overtaken "self.name);
                }
            }
            
    self.position--; //give yourself a position on one line below
            
    sql "UPDATE `Accounts` SET " +
                
    "toppos='" self.position "' " +
                
    "WHERE login='" self.stats["loginname"] + "'";
            
    mysql_query(level.mysqlsql);
            
    mysql_free_result(result);
            
    ///
            
    player self;
            
    players getEntArray("player""classname");
            for (
    0players.sizei++) {
                if (
    players[i].pers["language"] == "1")
                    
    players[iiprintln(self.name " ^4н^7овая ^4п^7озиция^2:^7" self.position);
                else if (
    players[i].pers["language"] == "0")
                    
    players[iiprintln(self.name " ^4n^7ew ^4p^7osition^2:^7" self.position);
            }
            if (
    self.pers["language"] == "1")
                
    self iprintlnbold("^4Т^7воя ^4н^7овая ^4п^7озиция^2:^2" self.position);
            else if (
    self.pers["language"] == "0")
                
    self iprintlnbold("^4Y^7our ^4n^7ew ^4p^7osition^2:^2" self.position);
        }

    BUT during the game at some moment straying column toppos. ONLY toppos! WHY!? pls Help
    For example, who was in the first position is reset to the last.
    Last edited by kung foo man; 30th April 2016 at 07:23. Reason: jsbeatified code + php tags

  2. #2
    Private Paho's Avatar
    Join Date
    Feb 2014
    Location
    Russia
    Posts
    101
    Thanks
    43
    Thanked 48 Times in 37 Posts
    pls help

  3. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    I have no idea what you're trying to accomplish.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  4. #4
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    TOP PLAYERS, PLAYERS SORT BY KILLS, UNDERSTAND?
    EXAMPLE:
    Code:
    TOP POS:  NAME PLAYER:     KILLS(PTS):
    ==1==     ^1Freddy           312511
    ==2==     Unknown Soldier    286388
    ==3==     Played.nL.28       175262
    Last edited by maxdamage99; 1st May 2016 at 11:14.

  5. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    PHP Code:
    SELECT namekills FROM tablename_here ORDER BY kills DESC LIMIT 10 
    I'm pretty sure this is NOT exactly what you want, but this follows your request. So please clarify your request.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  6. #6
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    your query make TOP10, we want TOP(ALLPLAYERS)

  7. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    then change the 10 to whatever number you want.

    If that does not answer your question, ask it again, provide some paint image, tell the same thing 3x in different wording. Try to get your question past the language barrier.

    I'm fine with doing some MySQL query writing for you, if you provide information about your database and can actually make your question clear.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. #8
    Private Paho's Avatar
    Join Date
    Feb 2014
    Location
    Russia
    Posts
    101
    Thanks
    43
    Thanked 48 Times in 37 Posts
    need to display each player's position, number of kills to the next position, if the player has overtaken - changing position + iprint new pos.
    looking at the script does not understand?
    working script with file operations:
    PHP Code:
    init()
    {
    precacheString(&"^4“^7во¤ ^4н^7ова¤ ^4п^7озици¤^2:^2");
    precacheString(&"^4Y^7our ^4n^7ew ^4p^7osition^2:^2");
    }
    onPlayerConnecting()
    {
    p=self;
    f=openfile("yourlogin/"+p.pers["loginname"]+".txt","read");
    if(
    f==-1)
    p.killplayers=0;
    else
    {
    freadln(f);
    p.killplayers int(fgetarg(f,0));
    closefile(f);
    }
    f=openfile("killstatlogin/"+p.pers["loginname"]+".txt","read");
    if(
    f==-1)
    {
    f=openfile("lastpos1/"+"statistik1"+".txt","read");
    freadln(f);
    p.lastpos int(fgetarg(f,0));
    closefile(f);
    p.lastpos++;
    p.position p.lastpos;
    f=openfile("lastpos1/"+"statistik1"+".txt""write");
    fprintln(fp.lastpos);
    closefile(f);
    f=openfile("killstatlogin/"+p.pers["loginname"]+".txt""write");
    fprintln(fp.position);
    closefile(f);
    f=openfile("yourpos1/"+p.position+".txt""write");
    fprintln(fp.pers["loginname"]);
    closefile(f);
    }
    else
    {
    freadln(f);
    p.position int(fgetarg(f,0));
    closefile(f);
    }
    f=openfile("yourlogin/"+p.pers["loginname"]+".txt","write");
    fprintln(fp.killplayers);
    fprintln(fp.name);
    closefile(f);
    }
    kilstat()
    {
    player=self;
    f=openfile("killstatlogin/"+self.pers["loginname"]+".txt","read");
    freadln(f);
    self.position int(fgetarg(f,0));
    closefile(f);
    f=openfile("yourlogin/"+self.pers["loginname"]+".txt","write");
    fprintln(fself.killplayers);
    fprintln(fself.name);
    closefile(f);
    if(
    self.position )
    {
    self.playetop self.position;
    self.playetop--;
    f=openfile("yourpos1/"+self.playetop+".txt","read");
    freadln(f);
    self.playerguid fgetarg(f,0);
    closefile(f);
    f=openfile("yourlogin/"+self.playerguid+".txt","read");
    freadln(f);
    self.playerfrags int(fgetarg(f,0));
    closefile(f);
    if(
    self.killplayers>self.playerfrags)
    {
    f=openfile("yourpos1/"+self.playetop+".txt""write");
    fprintln(fself.pers["loginname"]);
    closefile(f);
    f=openfile("yourpos1/"+self.position+".txt""write");
    fprintln(fself.playerguid);
    closefile(f);
    f=openfile("killstatlogin/"+self.playerguid+".txt""write");
    fprintln(fself.position);
    closefile(f);
    f=openfile("killstatlogin/"+self.pers["loginname"]+".txt""write");
    fprintln(fself.playetop);
    closefile(f);
    self.position self.playetop;
    players getEntArray("player""classname");
    for(
    0players.sizex++)
    {
    if(
    players[x].pers["loginname"]==self.playerguid)
    {
    players[x].position = (self.playetop+1);
    }
    }
    fuck=0;
    self.posintop destroy();
    self.posintop newClientHudElem(self);
    self.posintop.alignX "center";
    self.posintop.alignY "middle";
    self.posintop.320;
    self.posintop.150;
    self.posintop.fontscale 1;
    self.posintop.alpha 0.25;
    if(
    self.pers["language"]=="1")
    self.posintop.label = &"^4“^7во¤ ^4н^7ова¤ ^4п^7озици¤^2:^2";
    else
    self.posintop.label = &"^4Y^7our ^4n^7ew ^4p^7osition^2:^2";
    self.posintop setValue(self.position);
    for(
    010i++)
    {
    self.posintop.fontscale 1+fuck;
    self.posintop.alpha 0.5+fuck;
    self.posintop setValue(self.position);
    fuck+=0.15;
    wait 0.05;
    }
    wait 1;
    fuck=0;
    for(
    010i++)
    {
    self.posintop.alpha 0.5-fuck;
    self.posintop setValue(self.position);
    fuck+=0.15;
    wait 0.1;
    }
    self.posintop destroy();
    self endon("gandon");//предотвращаем написание текстовки более одного раза, например при взрыве с C4
    wait 0.05;//все вайты вход¤т в промежуток endon - notify
    for(i=0;i<players.size;i++)
    {
    if(
    players[i].pers["language"]=="1")
    players[iiprintln(self.name " ^4н^7ова¤ ^4п^7озици¤^2:^7"+self.position);
    else if(
    players[i].pers["language"]=="0")
    players[iiprintln(self.name " ^4n^7ew ^4p^7osition^2:^7"+self.position);
    }
    self notify("gandon");
    }
    }


  9. #9
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Omfg, man you think SERVER NO CRASH by query:
    PHP Code:
    SELECT namekills FROM tablename_here ORDER BY kills DESC LIMIT 6000 
    per every 2-3 seconds

  10. #10
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    What do you need the top 6000 for.

    EXPLAIN YOUR DAMN QUESTION.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Posting Permissions

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