Jump to content

Question about Pingkicker


Lovinglife

Recommended Posts

https://forum.multitheftauto.com/viewtop ... 08&t=21109 this is the topic about pingkicker... i wonder know how can i do that pingkicker kicks people Onplayerspawn and not Onplayerconnect...cause when ur downloading stuff ur ping is high and u get kicked...bcuz that is rly annoyin....

Plus

What i would suggest is making a new topic, requesting a Ping Kicker script that will not kick anyone while a download is active from the server.

so it would probably have to be client sided to check each client for if they are downloading. and if so, not kick them, and give them another 15 seconds after DL finishes before checking. to make sure their pings have returned to normal.

regards

Lovinglife

Link to comment

heres simple clientside version:

--clientside
pinglimit=1000
 
function isdownloading()
if isTransferBoxActive() then
setTimer(isdownloading,3000,1)
else
   addpingkicker()
end
end
 
function addpingkicker()
if not pingtimer then
   pingtimer=setTimer(function() 
     newping=getPlayerPing(getLocalPlayer()) 
if newping>=pinglimit then
triggerServerEvent("kickpinger",getRootElement(),newping,pinglimit) 
end 
end,1000,0)
end
end
 
addEventHandler("onClientPlayerSpawn",getRootElement(),isdownloading)
 
--serverside
 
function kickpinger(newping,pinglimit)
kickPlayer(client,"your ping was higher than limit("..pinglimit..")!")
outputChatBox("\'\'"..getPlayerName(client).."#64ff00\'\' has been kicked for too high ping("..newping..") || limit is "..pinglimit.."!",getRootElement(),100,255,0,true)
end
 
addEvent("kickpinger",true)
addEventHandler("kickpinger",getRootElement(),kickpinger)

please say if i forgot smthing :roll:

Edited by Guest
Link to comment
heres simple clientside version:
--clientside
pinglimit=1000
 
function isdownloading()
if isTransferBoxActive() then
setTimer(isdownloading,3000,1)
else
   addpingkicker()
end
end
 
function addpingkicker()
if not pingtimer then
   pingtimer=setTimer(function() 
     newping=getPlayerPing(getLocalPlayer()) 
if newping>=pinglimit then
triggerServerEvent("kickpinger",getRootElement(),newping) 
end 
end,1000,0)
end
end
 
addEventHandler("onClientPlayerSpawn",getRootElement(),isdownloading)
 
--serverside
pinglimit=1000
 
function kickpinger()
kickPlayer(client,"your ping was higher than limit("..pinglimit..")!")
outputChatBox("\'\'"getPlayerName(client).."#64ff00\'\' has been kicked for too high ping("..newping..") || limit is "..pinglimit"!",getRootElement(),100,255,0,true)
end
 
addEvent("kickpinger",true)
addEventHandler("kickpinger",getRootElement(),kickpinger)

please say if i forgot smthing :roll:

uhmm ty...

btw i didnt understand...i got already my client and server side....what should i do with ur code? Adding it? i just see the code is a bit different than the one i got from that topic

Link to comment
basicly u need integrate that "isdownloading" function and replacing onClientPlayerJoin with onClientPlayerSpawn

edit:fixed my code litle

wow, ty for ur "work"

And is anyone able to tell me how to:

outputChatBox ("Pingkicker: You will be kicked in 3 seconds, reason: Too high ping (Max: " .. maxPingValue .. ")", thePlayer, 255, 0, 0)

this appear only in player chat...

i need that everyone on the server can read "warning: PLAYER A got (value) ping"

Link to comment
replace ur "thePlayer" with GetRootElement(),

anyway i dont see why u should put my work in quotes, isn't that i wrote some code from zero just to help u enough?

lol i dont mean nothing

i mean ur "help" but thats it a "work" more than a simple "help"

btw ty again im gonna try the output

Link to comment
any errors?dont forget we are trying to help u, not u to us, do /debugscript 3 and see is there any bugs, othervise cant help

yeah i know it

btw i get this error ERROR: Client triggered serverside event kickpinger, but event is not added serverside....

Btw i ve been thinkin that i could need a "warningtimes cmd"...for istance, my ping is 130 and i get 1st warning..it appears "blabla got 1/*(value) warning"..

when i get the 3rd(if i type /warningtimes 3, so max is 3)warning i get kicked...

outputChatBox ("Pingkicker: " .. getClientName(thePlayer) .. "AVVISO UNO (ping alto) (Max: " .. maxPingValue .. ")", getRootElement(), 255, 0, 0)
				outputChatBox ("Pingkicker: blabla, reason: Too high ping (Max: " .. maxPingValue .. ")", thePlayer, 255, 0, 0)

i need something to appy here :

outputChatBox ("Pingkicker: " .. getClientName(thePlayer) .. "AVVISO UNO (ping alto) (Max: " .. maxPingValue .. ")", getRootElement(), 255, 0, 0)...<--- this warning should get Value 1....so i may use an other fuct to do what i type...

why i need this? to avoid ping bounce...coz i am organizin a tournament...and direct kick is too bad

Regards

Lovinglife

Link to comment

1)dont have clue why events dont trigger

2)130 ping is WAY too small to get kicked, it shoudl be 400 at minimum

3)for warings implend in script smthing like it:

warnigs=0
function name(...)
  ...
if warnings<=3 then
     outputchatbox(...)
     warnings=warinigs+1
else
     kick
...
end

Link to comment

hi again...i'm getting this issue... ->>>>>>>>>>>>> http://img651.imageshack.us/img651/8760 ... 161634.png

It should be : Each player got his warnings :

Vale 3/1, 3/2, 3/3...etc...

Jo 3/1, 3/2, 3/3...etc...

Instead of Vale 3/1,Jo 3/2, Vale 3/3...etc...Kick.

Every player must have his warnings....

This is the code's piece u need to see....

if (maxPingEnabled) then
		if (playerPing > maxPingValue) then
			TogglePingWarning(thePlayer, true) 
			avvisiKick = avvisiKick + 1

i think that here i should add something like "for index, thePlayer in ipairs(getElementsByType("player")) do" or "if (isElement(thePlayer))" i rly dont know...i need something that assignes different warnings to each player

Link to comment
you can use a table with all players or even easier element data.
if (maxPingEnabled) then
if (playerPing > maxPingValue) then
			TogglePingWarning(thePlayer, true) 
setElementData(thePlayer,"pingwarnings",tonumber(getElementData(thePlayer,"pingwarnings"))+1)

hey ...

i saw "nil" value if i use debugscript3....Attempt to perform on arit on nil value

on top i got

avvisiSettati=2

avvisiKick=0

i guess i should try

avvisisettati

or avvisikick

as Onresourcestart

local value7 = get('avvisisettati')

if (value7) then

avvisiSettati = value7

end

local value8 = get('avvisikick')

if (value8) then

avvisiKick = value8

end

?

@Karlis i didnt understand, i kinda such with lua, damn it

Should i do same things on client side?

Thanks both ofc !

Link to comment

get("name") is serverside function for such options in meta.xml :

<settings>
<setting name="*name" value="values in JSON" />
   ...
settings>

for JSON info watch: https://forum.multitheftauto.com/viewtop ... 91&t=26845

-------

and i just say you should move all warnings system clientside, that would delete many pain in ass,

btw if tis hard for you you could post whole code and if ill have time i could rewrite warings myself

Link to comment
get("name") is serverside function for such options in meta.xml :
<settings>
<setting name="*name" value="values in JSON" />
   ...
settings>

for JSON info watch: https://forum.multitheftauto.com/viewtop ... 91&t=26845

-------

and i just say you should move all warnings system clientside, that would delete many pain in ass,

btw if tis hard for you you could post whole code and if ill have time i could rewrite warings myself

hey karlis, sup

that Json seems kinda hard for me...btw...my warnings system is composed by a cmd to set up "avvisisettati" (the number u cant go on) and a value avvisikick, starts 0, (=avvisisettati+1,each time u if (playerPing > maxPingValue)) when ur aKick is bigger than aSettati u get kicked :D.

and i appreciate ur usefull help but i d like to try alone...btw what i explained above is in server side...should i move that to client side (i think i cant bcuz of CMD(server side, right, only?) or only the thing "

if (playerPing > maxPingValue) then
			TogglePingWarning(thePlayer, true)
                                bla bla 
avvisiKick = avvisiKick + 1

and if only that piece of code, how?

Regards

Link to comment

you can do like u showed, but i see you don't have real purpose to do so anymore, as you did all already serverside, but yes, u CAN addCommandHandler clientside

anyway if you want trigger kick/ban from clientside

be sure you do folowing check

if this==source then
  kick
  ...
end

or

kickPlayer(this,blabla) --not "source", but "this"

since then player cant trigger to kick other player

Link to comment
you can do like u showed, but i see you don't have real purpose to do so anymore, as you did all already serverside, but yes, u CAN addCommandHandler clientside

anyway if you want trigger kick/ban from clientside

be sure you do folowing check

if this==source then
  kick
  ...
end

or

kickPlayer(this,blabla) --not "source", but "this"

since then player cant trigger to kick other player

I think you should spend more time on wiki. Not "this" but "client" since event handler is not attached to player but root element (in the script on the 1st page of this topic).

https://wiki.multitheftauto.com/wiki/AddEventHandler

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...