Author Topic: [unstable] pingWarning  (Read 3970 times)

0 Members and 1 Guest are viewing this topic.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
[unstable] pingWarning
« on: November 11, 2006, 12:47:41 pm »
Script Name: pingWarning
Script Description: script showing if you getting ping warnings and how many more to get kicked
Original Author: cooz
Core Version: 2.5.2

Code: [Select]
var
  pingwarnings: array[1..32] of integer;
  i: integer;

function IDtoPing(PlayerID: integer):integer;
begin
  case PlayerID of
    1: Result:= Player_Ping_1;
    2: Result:= Player_Ping_2;
    3: Result:= Player_Ping_3;
    4: Result:= Player_Ping_4;
    5: Result:= Player_Ping_5;
    6: Result:= Player_Ping_6;
    7: Result:= Player_Ping_7;
    8: Result:= Player_Ping_8;
    9: Result:= Player_Ping_9;
    10: Result:= Player_Ping_10;
    11: Result:= Player_Ping_11;
    12: Result:= Player_Ping_12;
    13: Result:= Player_Ping_13;
    14: Result:= Player_Ping_14;
    15: Result:= Player_Ping_15;
    16: Result:= Player_Ping_16;
    17: Result:= Player_Ping_17;
    18: Result:= Player_Ping_18;
    19: Result:= Player_Ping_19;
    20: Result:= Player_Ping_20;
    21: Result:= Player_Ping_21;
    22: Result:= Player_Ping_22;
    23: Result:= Player_Ping_23;
    24: Result:= Player_Ping_24;
    25: Result:= Player_Ping_25;
    26: Result:= Player_Ping_26;
    27: Result:= Player_Ping_27;
    28: Result:= Player_Ping_28;
    29: Result:= Player_Ping_29;
    30: Result:= Player_Ping_30;
    31: Result:= Player_Ping_31;
    32: Result:= Player_Ping_32;
  end;
end;

procedure AppOnIdle(Ticks: integer);
begin
  if Ticks mod 420 = 0 then begin
    for i:= 1 to 32 do begin
     if(IDtoPing(i)>strtoint(ReadINI('soldat.ini','NETWORK','Max_Ping','10000'))) then begin
        pingwarnings[i]:=pingwarnings[i]+1;
        SaytoPlayer(i,'you just got ping warning');
        SaytoPlayer(i,inttostr(strtoint(ReadINI('soldat.ini','NETWORK','Max_Ping_Warnings','10000'))-pingwarnings[i])+' more and you''ll be kicked');
        if (pingwarnings[i]=strtoint(ReadINI('soldat.ini','NETWORK','Max_Ping_Warnings','10000'))) then pingwarnings[i]:=0;
      end;
    end;
  end;
end;

nots:
based on Ensce code demo,
made on Leo request,

i broke msg into 2 lines cause it was showing with this nasty small font...
« Last Edit: November 21, 2006, 08:00:16 pm by cooz »
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: pingWarning
« Reply #1 on: November 11, 2006, 01:34:52 pm »
Thanks cooz, you are the best :)

Offline UpNorth.se

  • Major(1)
  • Posts: 7
Re: [unstable] pingWarning
« Reply #2 on: November 23, 2006, 05:53:07 pm »
Nice one. Good work cooz.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
Re: [unstable] pingWarning
« Reply #3 on: November 23, 2006, 06:16:49 pm »
thanks, but it doesn't work as i wish to,
i hope i'll be able to update it after next soldat/server version release...
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like

Offline UpNorth.se

  • Major(1)
  • Posts: 7
Re: [unstable] pingWarning
« Reply #4 on: November 23, 2006, 06:55:24 pm »
I tested it before, the problem I got with it was that it
counted down to 0 and then began on 10 again and
when it was like 8 for the second time the person
were kicked by the server. It could have been my fault
though, maybe there was something in the script I
should have changed..

What's the problem with it that you are referring to?

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
Re: [unstable] pingWarning
« Reply #5 on: November 23, 2006, 07:07:36 pm »
i'm referring exactly to problem you're writing about, i need more accurate way to determine if person is getting ping warning, and it's rather hard in current server version
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like

Offline UpNorth.se

  • Major(1)
  • Posts: 7
Re: [unstable] pingWarning
« Reply #6 on: November 23, 2006, 07:24:47 pm »
Ah all right.

Offline FliesLikeABrick

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 6142
    • Ultimate 13 Soldat
Re: [unstable] pingWarning
« Reply #7 on: November 25, 2006, 10:38:23 pm »
I figured that linking this would be appropriate: http://www.soldatforums.com/index.php?topic=8064.0

Just a bug that is afflicting this script in one of Leo's servers.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
Re: [unstable] pingWarning
« Reply #8 on: November 26, 2006, 04:22:16 am »
yes, i know about this bug from Leo,
cause time checking method is not precise enough to determine if someone got ping warning
and i can't think up any other one for now,

script has [unstable] status - please wait for any updates of it,
oh and also i think Leo did turn of scripts in his server cause of some memory leaks...
so probably 4X4 didn't have this bug recently
« Last Edit: November 26, 2006, 04:48:48 am by cooz »
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like