Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Leo on November 11, 2006, 05:39:12 am

Title: [Request] Notify players by PM for ping warnings
Post by: Leo on November 11, 2006, 05:39:12 am
Most players don't even know that they get ping warnings. So they suddenly get kick/banned without knowing what happened. Some nice scripter maybe can make me a script that will send a PM to the player with a notify that he is getting ping warnings and he is gonna get kicked and banned for 15 minutes ? Something like "Ping warning 1 out of <insert number of ping warnings here according to the server settings>"
Title: Re: [Request] Notify players by PM for ping warnings
Post by: EnEsCe on November 11, 2006, 07:06:07 am
There isn't a way to determine when a player gets a ping warning using the scripting core. Possible with ARSSE though.
Title: Re: [Request] Notify players by PM for ping warnings
Post by: Leo on November 11, 2006, 07:57:08 am
Not possible with ARSSE I think. OnData event doesn't support parameter $PLAYER_NAME :(
Title: Re: [Request] Notify players by PM for ping warnings
Post by: cooz on November 11, 2006, 08:51:29 am
what about checking all players ping every second?

and when server gives ping warning anyway?
if after 3 seconds of having too high ping then it's possible to determine...
Title: Re: [Request] Notify players by PM for ping warnings
Post by: Leo on November 11, 2006, 08:58:47 am
 cooz, I don't know how exactly this works. If you can make something it would be nice :)
Title: Re: [Request] Notify players by PM for ping warnings
Post by: cooz on November 11, 2006, 09:08:38 am
i can try, but i have to be 100% sure how ping warnirng system works otherwise script won't work precisely

could anyone with source of soldat server bring such knowledge here, please?  ::)
Title: Re: [Request] Notify players by PM for ping warnings
Post by: Mr. Domino on November 11, 2006, 10:22:35 am
This is a great idea, and on that note I think it'd be nice if the message was stored on the user's computer and displayed when trying to reconnect. Often times the kick comes so quickly that a player cannot see any messages to see the reason for it, and reconnect attempts just display the generic "You have been banned from this server" message.
Title: Re: [Request] Notify players by PM for ping warnings
Post by: EnEsCe on November 11, 2006, 11:09:05 am
Pings are checked every 420 ticks... So in AppOnIdle just do
Code: [Select]
if Ticks mod 420 = 0 then begin
  for i := 1 to 32 do
    if GetPlayerStat(i, 'ping') > MaxPing then begin
      WriteLn('ohhh a ping warning for ' + IDToName(i));
    end;

EDIT: Woops 2.6.0 function in there... suppliment it with some other sloppy workaround...
Title: Re: [Request] Notify players by PM for ping warnings
Post by: cooz on November 11, 2006, 12:48:52 pm
done, here it's some other sloppy workaround (http://forums.soldat.pl/index.php?topic=7574)

edit:
btw Enesce, when pingwarnings reset?
Title: Re: [Request] Notify players by PM for ping warnings
Post by: chrisgbk on November 11, 2006, 01:37:36 pm
I think they only get reset when you are actually kicked or if you otherwise leave the game, but I'm not sure if they get reset at any other time.
Title: Re: [Request] Notify players by PM for ping warnings
Post by: cooz on November 11, 2006, 01:44:57 pm
ok, i made small update in scripts, but i'm still waitting for 100% sure information  ::)
eg. on leave game...
Title: Re: [Request] Notify players by PM for ping warnings
Post by: Leo on November 12, 2006, 05:00:04 am
cooz, there is still something wrong with the script. When I joined I saw a warning about -73 warnings remaining, after I changed "'strtoint(ReadINI('soldat.ini','NETWORK','Max_Ping_Warnings','10000'))' to 6, the number of warnings were right but it was like "0 more and you''ll be kicked" and then it went to "-1 more and you''ll be kicked", "-2 more and you''ll be kicked" ....
Title: Re: [Request] Notify players by PM for ping warnings
Post by: cooz on November 15, 2006, 12:19:39 pm
i have no clue why it's happening,
we've tested and values are read correctly from ini,
maybe just delete line which tells how many warnings left, for now
i'll look on it today later when i'll have acces to my server...

edit:
sorry for such delay, i didn't have mind for scripts for last few days,

i was testing pingWarning script and it works too randomly, i requested some feautures for next server version to better detect it... so for now let's give this script some time for rest