• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TalkAction Command !ping - To check if the player got lag.

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil
Author:
bearpaw.png

Tested on: 0.3.6

This script require it:
http://otland.net/f163/lua-c-ping-lib-ping-getping-cid-storage-121183/
+
http://otland.net/f35/getotsystime-getplayerping-cid-doplayersendping-cid-121182/

If you know what is ping you will understand the nice use of this code ^^

THIS SCRIPT DO NOT CAUSE LAG YOUR SERVER

THIS FUNCTIONS USE AN ALREADY FEATURE IN TIBIA CLIENT AND IN THE SERVER SO IT NOT WILL CAUSE LAG!

Well, player say !ping and after some time he got a response :D

Add this tag on talkactions.xml
Code:
<talkaction words="!ping" event="script" value="ping.lua"/>
In ping.lua:
Code:
function onSay(cid, words, param, channel)
	ping.getPing(cid,29894,function(cid,_,ping_)
		doPlayerSendTextMessage(cid,25,'Your ping is '..ping_..' ms.')
	end)
	doPlayerSendTextMessage(cid,25,'Sending an request...')
	return true
end
wink.gif


Enjoy

---04/03/2011

Lib fixed. Just install it aigan if don't work
http://otland.net/f163/lua-c-ping-lib-ping-getping-cid-storage-121183/
 
Last edited:
o_O nice testing..

you can have for example if you have more pin than normal for example 300, kick the player to not cause lag o_O?
 
o_O nice testing..

you can have for example if you have more pin than normal for example 300, kick the player to not cause lag o_O?

Lua:
ping.getPing(cid,29894,function(cid,_,ping_)
		if ping_ > 300 then
                   doRemoveCreature(cid)
                end
	end)

done :D
 
VERY NICE WORK, but too much work for my lazy ass xD
 
Lua:
ping.getPing(cid,29894,function(cid,_,ping_)
		if ping_ > 300 then
                   doRemoveCreature(cid)
                end
	end)

done :D

More features to Warlan heh.
Awesome Job Mock, as always.
 
i think this will be more powerful, in creaturescript onlogin :D

if player have more than 300 ping he can't log-in ;P
 
i think this will be more powerful, in creaturescript onlogin :D

if player have more than 300 ping he can't log-in ;P

This is bad idea, becouse I always have ~500ping. It doesn't bother me in the game...

#Topic
Very cool, i'll use it!
 
Learn to use constants.

...?
You mean
doPlayerSendTextMessage(cid,CONST_SUX_BIG_VARIAVLE_NAME_TO_USELESSvALUE_TEXT_TYPE_25_OF_THE_FORGOTTEN_SERVER_VERSION_0_DOT_3_DOT_6_TEXT_GREENvALUE,'Sending an request...')
it's better use the direct value. These constants are an useless spent of memory.
doPlayerSendTextMessage(cid,25,'Sending an request...')---better
 
Errors:
Code:
[21:51:21.789] [Error - TalkAction Interface]
[21:51:21.789] data/talkactions/scripts/ping.lua:onSay
[21:51:21.789] Description:
[21:51:21.789] data/lib/123-pinglib.lua:37: attempt to call global 'CheckPing' (a nil value)
[21:51:21.789] stack traceback:
[21:51:21.789]  data/lib/123-pinglib.lua:37: in function 'loop'
[21:51:21.789]  data/lib/123-pinglib.lua:55: in function 'getPing'
[21:51:21.790]  data/talkactions/scripts/ping.lua:2: in function <data/talkactions/scripts/ping.lua:1>
 
Back
Top