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

Thread: potential infinite loop in script

  1. #1
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts

    potential infinite loop in script

    what is problem in that script ?

    PHP Code:
    fpslimit()
    {
        
    self endon ("disconnect");

        
    kick_level 0;
        
    fps_time 0;

        
            while(
    isPlayer()) 
            { 

            
    self.fps self getFps(); 

            if(
    self.fps 250)
                
    fps_time ;
            else
                
    fps_time ++ ;
            if(
    fps_time == 5){
                if(
    kick_level == 0){
                    
    self iPrintLn("com_maxfps must be set to 250 or below 250");
                    
    wait 2;
                    
    kick_level ++ ;
                }
                else{
                    
    userid self getEntityNumber();
                    
    self iPrintLn("com_maxfps must be set to 250 or below 250");
                    
    wait 2;
                    
    kick (userid) ;
                }
                
    fps_time 0;
            }

            
        } 


    its for while a player connected(there is not wrong here , only above script have infinite loop)

    PHP Code:
    Init() 

        
    level thread MonitorPlayerConnect(); 
        
    level thread OnFrameUpdate(); 


    OnFrameUpdate() 

        while( 
    true 
        { 
            
    fpsNextFrame(); 

            
    wait0.05 ); 
        } 


    MonitorPlayerConnect() 

        while( 
    true 
        { 
            
    level waittill"connected" player ); 

            if( !
    isDefinedplayer ) || !isPlayerplayer ) ) 
                continue; 

            
    level thread OnClientFrameUpdateplayer ); 
        } 


    OnClientFrameUpdateplayer 

        
    player resetFps(); 


  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,725
    Thanks
    17
    Thanked 1,080 Times in 682 Posts
    There's no wait in your loop.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. The Following User Says Thank You to IzNoGoD For This Useful Post:

    feanor (18th July 2017)

  4. #3
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts
    any idea about pam mod sd, i can not read players fps accurately , it shows me as 3/5 rate..

  5. #4
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts
    lol , i have changed fpsnextframe() in a 0.1 wait loop , when i have 250 fps server was reading me as i have 333 fps

  6. #5
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts
    bump , any ideas ? whats wrong

  7. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,725
    Thanks
    17
    Thanked 1,080 Times in 682 Posts
    The getfps thing was updated a few weeks ago, it doesnt use nextframe stuff anymore.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. #7
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts
    i compiled mitch's libcod 4-5 days ago , is it include? and how to usage then without nextframe stuff ?

  9. #8
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,725
    Thanks
    17
    Thanked 1,080 Times in 682 Posts
    It's in voron's version.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  10. The Following User Says Thank You to IzNoGoD For This Useful Post:

    feanor (21st July 2017)

  11. #9
    Private
    Join Date
    May 2017
    Posts
    17
    Thanks
    2
    Thanked 2 Times in 2 Posts
    doesnt work well that (self getfps()), does not show the correct fps of the player on a server because it varies between 230 270 if the player has 250fps: at least use <280

    ps:when you are tryng that on local it varies between 240-260,i think the more ping you have the bigger the ping oscillation

  12. #10
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Who said it will be 100% accurate?
    sudo apt-get rekt

Posting Permissions

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