English Ping Limit System

6 replies
Goto Page
To the start Previous 1 Next To the start
06.10.12 08:20:05 pm
Up
SektoR_
User
Offline Off
Personal speech! I came here to ask if this script will work Ping Limit. us

° Will it work?

If not please show me the correct!

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
------------------------
--     INIT ARRAY     --
------------------------

function initArray(m)
local array = {}
for i = 1, m
do array[i]=0
end
return array
end


------------------------
--        HOOKS       --
------------------------

addhook("minute","ping")
addhook("second","contagemmm")


------------------------
--       CONFIG       --
------------------------

-- sv config, no lock.
tempoa=initArray(32)
contagemm=initArray(32)

-- Define here the ping limit:
ping_limit = 600


------------------------
--     FUNCTIONS      --
------------------------

function ping(id)
msg("©111222111This server has Ping Limit Control !")

for will = 1,32 do

if player(will,"exists") then
if player(will,"ping") >= ping_limit then
if contagemm[will] < 8 then
contagemm[will] = contagemm[will]+1
msg("©000255000"..player(will,"name").." your ping is "..player(will,"ping").." Close All Programs Or Is Kicked!!")
end
end

if contagemm[will] > 7 then
msg("©000255000"..player(will,"name").." Was kicked, For His Ping This "..player(will,"ping"))
parse("kick "..will)
end
end
end
end

function contagemmm()
for allid = 1,32 do
tempoa[allid] = tempoa[allid]+1
end
end
06.10.12 08:29:15 pm
Up
EngiN33R
Moderator
Offline Off
Uh, yes, it will work, except:

1. Why do you even need this kind of script if there's an in-built ping limit system?
2. Why do you need the 'tempoa' variable? It's not used and it makes the script heavier.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
06.10.12 08:34:34 pm
Up
Livia
User
Offline Off
No it doesn't work. You should reset contagemm[will] when kicking a player.
Software has no limits.
06.10.12 08:59:48 pm
Up
EngiN33R
Moderator
Offline Off
Yeah, I forgot - as said above, contagemm should be reset upon kicking a player or if he leaves himself.

If it were up to me, I'd make the script like this:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
warnings = {}
limit = 600

addhook("minute","checkping")
function checkping()
     msg("This server has ping control")
     for _,id in pairs(player(0,"table")) do
          if player(id,"ping")>=limit then
               if warnings[id] and warnings[id]>=3 then --I decided to make it 3 warnings (3 minutes of high ping) which is still too high in my opinion - it should be 2.
                    parse("kick "..id.." \"Ping too high!\"")
                    warnings[id]=nil
                    return
               end
               if not warnings[id] then warnings[id]=1 else warnings[id]=warnings[id]+1 end
               msg2(id,"Your ping is "..player(id,"ping").." which is "..player(id,"ping")-limit.." higher than our limit ("..limit..")")
               msg2(id,"Please close any applications that strain your bandwidth or try to find a server closer to you!")
          end
     end
end
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
08.10.12 02:24:47 am
Up
SektoR_
User
Offline Off
I decided to make this script to alert players that the ping of them are high, and so they take steps to lower your ping and not be kicked.

@user EngiN33R: His solution to be even easier! I like it.

Now I will try!
08.10.12 03:27:38 am
Up
sheeL
User
Offline Off
untested, but... is example

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
limitp = 600 - Ping Limit
warning = {}

addhook("join","_join")
function _join(id)
warning[id]=0
end

addhook("minute","_minute")
function _minute()
 for _,id in pairs(player(0,"table")) do
 if player(id,"ping") > limitp then
 warning[id]=warning[id]+1
 if warning[id] == 0 then
    msg2(id,"©255000255 blabla...")
    msg2(id,"©225000255 blabla..")
end
 if warning[id] == 1 then
    msg2(id,"©255000255 blabla...")
    msg2(id,"©225000255 blabla..")
end
 if warning[id] == 2 then
    msg2(id,"©255000255 blabla...")
    msg2(id,"©225000255 blabla..")
    parse("kick "..id.." \"Ping too high...!\"")
          end
      return 1
    end
  end
end
edited 3×, last 08.10.12 04:02:37 am
13.10.12 03:50:11 am
Up
SektoR_
User
Offline Off
@user sheeL: Ow cool! It is also a very good solution. I'll be testing too! Thanks.

@user EngiN33R: I did not understand the part of warnings[id]>=3 as well 3 warnings?
To the start Previous 1 Next To the start