• 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 Advanced Exiva (how many squares are from our target, and which town he is nearest)

Seminari

Banned User
Joined
Dec 13, 2009
Messages
1,496
Reaction score
34
Location
Poland
First u need this function:

http://otland.net/f163/lua-function-determination-nearest-town-town-closest-us-153316/


script:
Lua:
function onSay(cid, words, param, channel)



if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end

	player_x = getPlayerByName(param)
	
	poz = getCreaturePosition(player_x)
	cid_poz = getCreaturePosition(cid)
	roznica_pozX = (cid_poz.x - poz.x) 
	if roznica_pozX < 0 then
	roznica_pozX = -roznica_pozX
	end
	roznica_pozY = (cid_poz.y - poz.y) 
	if roznica_pozY < 0 then
	roznica_pozY = -roznica_pozY 
	end
	roznica_pozow = math.floor((roznica_pozX^2 + roznica_pozY^2)^(1/2))
	
	if roznica_pozow < 0 then
	roznica_pozow = -roznica_pozow
	end
	
	lol = getNajblizej(poz)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player: " .. param .. " is " .. math.ceil(lol[2]) .. " squares from city: " .. lol[1] .. ". You are from target: " .. roznica_pozow .. " squares.")
	

	return true
end
 
Nice script, Although.. You might want to tell people where to put the script. Keep in mind alot of people don't understand anything about the scripts. They just copy paste and hope it works haha
 
Back
Top