[Code]Simple way of PingLimiter

Results 1 to 8 of 8
  1. #1
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    note [Code]Simple way of PingLimiter

    Code:
    if(strstr(ZGetGameClient()->GetStageName(),"[P=40]"))
    {
    #define MIN_PING 40
    		int nPing = (pCharacter->GetUID() == ZGetGameClient()->GetPlayerUID() ? 0 : MIN_PING);
    		MMatchPeerInfo* pPeer = ZGetGameClient()->FindPeer(pCharacter->GetUID());
    		if (pPeer) {
    			if ( ZGetGame()->IsReplay())
    				nPing = 0;
    			else
    				nPing = pPeer->GetPing(ZGetGame()->GetTickTime());
    		}
    		pItem->nPing = nPing;
    		pItem->bMyChar = pCharacter->IsHero();
    }
    else
    {
    		int nPing = (pCharacter->GetUID() == ZGetGameClient()->GetPlayerUID() ? 0 : MAX_PING);
    		MMatchPeerInfo* pPeer = ZGetGameClient()->FindPeer(pCharacter->GetUID());
    		if (pPeer) {
    			if ( ZGetGame()->IsReplay())
    				nPing = 0;
    			else
    				nPing = pPeer->GetPing(ZGetGame()->GetTickTime());
    		}
    		pItem->nPing = nPing;
    		pItem->bMyChar = pCharacter->IsHero();
    }
    To best honest it's realy simple way, well it will work ?










    18/4
    Code:
    if (pPeer) {
    			if ( ZGetGame()->IsReplay())
    				nPing = 0;
    #define TEST 80
    			else if(nPing > TEST)
                    ZApplication::GetGameInterface()->ReserveLeaveBattle();
    			else
    				nPing = pPeer->GetPing(ZGetGame()->GetTickTime());
    }
    Last edited by qet123; 18-04-12 at 02:51 PM. Reason: New CODE!!


  2. #2
    Wait wut PenguinGuy is offline
    MemberRank
    Apr 2010 Join Date
    United StatesLocation
    765Posts

    Re: [Code]Simple way of PingLimiter

    ... Where's the check to see if the ping is greater than the allowed amount?
    Also, sscanf_s.
    Posted via Mobile Device

  3. #3
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: [Code]Simple way of PingLimiter

    Quote Originally Posted by PenguinGuy View Post
    ... Where's the check to see if the ping is greater than the allowed amount?
    Also, sscanf_s.
    Posted via Mobile Device
    He doesn't know what he's doing.

  4. #4
    Daemonsring Developer Gunblade is offline
    MemberRank
    Jul 2007 Join Date
    On the moonLocation
    728Posts

    Re: [Code]Simple way of PingLimiter

    qet123, please visit Learn C++ and do the tutorials.
    When you've done that you will understand the insides of the GunZ engine and it would be a lot easier for you to create functions like ping limiters.

  5. #5
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: [Code]Simple way of PingLimiter

    Quote Originally Posted by PenguinGuy View Post
    ... Where's the check to see if the ping is greater than the allowed amount?
    Also, sscanf_s.
    Posted via Mobile Device
    PingLimiter done by increasing MAX_PING = 999, what i have done here that 'increased' it to 40, which that means more than 40 will be lagger. Look at the code again. The question is I am right? Increasing the MAX_PING thing?

  6. #6
    Wait wut PenguinGuy is offline
    MemberRank
    Apr 2010 Join Date
    United StatesLocation
    765Posts

    Re: [Code]Simple way of PingLimiter

    Quote Originally Posted by qet123 View Post
    PingLimiter done by increasing MAX_PING = 999, what i have done here that 'increased' it to 40, which that means more than 40 will be lagger. Look at the code again. The question is I am right? Increasing the MAX_PING thing?
    Pseudo
    Join stage -> Ping to master -> MMessageBox( "Your latency is too far away to join this match. (Less than %d ping required)", GetStage()->GetMaxPing() ); -> KickFromStage();

  7. #7
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: [Code]Simple way of PingLimiter

    Quote Originally Posted by PenguinGuy View Post
    Pseudo
    Join stage -> Ping to master -> MMessageBox( "Your latency is too far away to join this match. (Less than %d ping required)", GetStage()->GetMaxPing() ); -> KickFromStage();
    Code:
    if (pPeer) {
    			if ( ZGetGame()->IsReplay())
    				nPing = 0;
    #define TEST 80
    			else if(nPing > TEST)
                    ZApplication::GetGameInterface()->ReserveLeaveBattle();
    			else
    				nPing = pPeer->GetPing(ZGetGame()->GetTickTime());
    }
    I just need simple code to done the job, I think this will? I don't have players to test with.
    Last edited by qet123; 18-04-12 at 02:58 PM.

  8. #8
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: [Code]Simple way of PingLimiter

    Learn to use multiple instances, first of all.

    Second, that elseif statement is absolutely invalid.
    Posted via Mobile Device



Advertisement