Raised This Month: $51 Target: $400
 12% 

[ANY]Get average ping


Post New Thread Reply   
 
Thread Tools Display Modes
Author
pcquad
Member
Join Date: Jan 2012
Plugin ID:
3475
Plugin Version:
1
Plugin Category:
Statistical
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Get average ping
    Old 01-17-2013 , 12:26   [ANY]Get average ping
    Reply With Quote #1

    Hi,
    this simple little plugin prints the average player ping from the online players on the server.

    Command:
    !getpings

    Its as simple as powerful. Im using it for the case if my server starts to lagg and im trying to find out
    what the reason therefor is.

    Its kind of my first plugin , so its ok if there are a lot of things that need to be changed , nevertheless it is working
    Attached Files
    File Type: sp Get Plugin or Get Source (getping.sp - 443 views - 1.2 KB)
    __________________

    Last edited by Sheepdude; 01-17-2013 at 15:50. Reason: shady binary attachment
    pcquad is offline
    MasterOfTheXP
    Veteran Member
    Join Date: Aug 2011
    Location: Cloudbank
    Old 01-17-2013 , 12:58   Re: [ANY]Get average ping
    Reply With Quote #2

    The plugin's source fails to compile with 3 errors and 7 warnings, and there's no source for the compiled one. There's also no need to attach a compiled binary with a plugin's source that compiles with "Get Plugin". (It actually isn't allowed.) That all said, a few things to note...

    Your tabbing and line spacing is a little wonky. In Notepad++'s menubar, TextFX -> TextFX Edit -> Re-indent C++ code automatically fixes your tabbing. As for the space in between the lines...
    PHP Code:
    public Action:getpings(clientargs)
    {



        new 
    Float:Ping
    That's a lot of...nothing. You should probably get rid of it.

    Pingaverage needs to be declared, and with that, all errors should be fixed. Still, though, for this:
    PHP Code:
    // First, let's get a count of the players in-game.
        
    new Players 0;
        for (new 
    1<= MaxClientsi++)
        {
            if (
    IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i))
                
    Players++;
        } 
    It'd actually be better to increment the Players variable in the second for loop. No need to make another for loop and do it before, since we're only getting the average after both loops are done.

    And finally, after the PrintToChatAll:
    PHP Code:
    Pingaverage 0;
            
    Ping 0;
            
    Pinga 0
    There's no need to reset locally used variables
    __________________
    Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
    MasterOfTheXP is offline
    Sheepdude
    SourceMod Donor
    Join Date: Aug 2012
    Location: Chicago
    Old 01-17-2013 , 15:48   Re: [ANY]Get average ping
    Reply With Quote #3

    You can attach a binary if the plugin won't compile due to missing includes or extensions, but this is not one of those cases. It's especially troubling since the source doesn't compile at all due to the errors, so the binary that was attached couldn't possibly be the same plugin as the source.
    __________________
    Sheepdude is offline
    pcquad
    Member
    Join Date: Jan 2012
    Old 01-17-2013 , 17:24   Re: [ANY]Get average ping
    Reply With Quote #4

    hm sorry then , its strange because i wondered why it compiled fine on my compiler but not here ...
    probably uploaded wrong source
    __________________
    pcquad is offline
    Sheepdude
    SourceMod Donor
    Join Date: Aug 2012
    Location: Chicago
    Old 01-17-2013 , 17:28   Re: [ANY]Get average ping
    Reply With Quote #5

    Quote:
    Originally Posted by pcquad View Post
    hm sorry then , its strange because i wondered why it compiled fine on my compiler but not here ...
    probably uploaded wrong source
    Reupload the correct source and make sure the "Get Plugin" link works. If it does, then the online compiler is able to successfully compile the plugin.
    __________________
    Sheepdude is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 18:13.


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