• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Walk Speed Test!

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Reaction score
53
Location
Włocławek
Hello, and wondered how fast your character moves?
Now you can check it out, receiving a precise result!
The script checks walking speed by SQM moves per second!

Advantages:
* Not using storage values / sql database!
* Easy instalation
* Easy command : )


Commands:
* !speed start
* !speed stop

How do use?
* msg at public channel: !speed start
- go walk, do not around or return return back!
* msg at public channel: !speed stop
- To you has been sent text with result! :)


How do install? - EASY!

1. go to data/lib/ folder and open in editor file "data.lua"
2. add in first line:
PHP:
speedTests = {}
3. go to folder data/talkactions/ and open in editor talkactions.xml
4. under: "<talkactions>" add:
PHP:
<talkaction log="yes" access="0" words="!speed" event="script" value="speedtest.lua"/>
5. now go to folder data/talkactions/scripts/ and create file: "speedtest.lua" and past into file this code:
PHP:
function onSay(cid, words, param, channel)
	speedTests[getPlayerGUID(cid)] = {}
	local player_data = speedTests
	local position = getPlayerPosition(cid)
	local sqm = 0
	local getTime = 0
	if param == "start" then
		if player_data.starter ~= 1 then
			player_data.starter = 1
			player_data.timer = os.time()
			player_data.position = {x=position.x, y=position.y}
			doPlayerSendTextMessage(cid, 19, "Test started please walk!")
		else
			doPlayerSendCancel(cid, "You have arleady started test.")
		end
	elseif param == "stop" then
		if player_data.starter == 1 then
			if player_data.position.x > position.x then
				sqm = sqm+(player_data.position.x-position.x)
			else
				sqm = sqm+(position.x-player_data.position.x)
			end
			if player_data.position.y > position.y then
				sqm = sqm+(player_data.position.y-position.y)
			else
				sqm = sqm+(position.y-player_data.position.y)
			end
			local getTime = os.time()-player_data.timer
			doPlayerSendTextMessage(cid, 19, "You can walk "..math.abs(sqm/getTime).." SQM/sec.")
			player_data.starter = 0
		else
			doPlayerSendCancel(cid, "You haven't any test started.")
		end
	end
	return TRUE
end

Now you can use script and results:
speedtest.jpg
 
Back
Top