• 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!

Lua Script House scroll?

GOD Wille

Excellent OT User
Joined
Jan 11, 2010
Messages
2,826
Solutions
2
Reaction score
815
Location
Sweden
Hi
I need a script of a house scroll that teleports the character to his house, the one he owns? and with a cooldown of 5 minutes?

And if clicking on it and he already used it it should stays " it is 5/4/3/2/1 minutes left til u can use it?

Rep++!
 
Last edited:
You can do this, but player will be placed outdoor, where house entry is located. More advanced system is also possible, however it will require you to setup every house teleport place in script, or make it automatically with algorithm for searching corresponding tile.

First one is simple:
Code:
doTeleportThing(cid, getHouseByPlayerGUID(getPlayerGUID(cid))
 
LUA:
function onUse(cid, item, frompos, item2, topos)
local config = {
	houseInfo = getHouseInfo(getHouseByPlayerGUID(getPlayerGUID(cid)))
	}
	doTeleportThing(cid, config.houseInfo.entry)
	return true
end

p.s without exhaust
 
Ty Rep++


Please someone know how to add 5 mins exhaustion?

And if clicking on it and he already used it it should stays " it is 5/4/3/2/1 minutes left til u can use it?
 
a nice timer :)
so it says You can use in : 4:30 , 4:01 , etc
LUA:
local storage = 1845
local exhausted = 300  -- 5 min = 5 * 60   --in seconds
 function onUse(cid, item, frompos, item2, topos) 
 local config = {
        houseInfo = getHouseInfo(getHouseByPlayerGUID(getPlayerGUID(cid)))
        }
       local seconds = getPlayerStorageValue(cid, storage) - os.time()
	local minutes = 0
	while seconds >= 60 do
		minutes = minutes + 1
     
		seconds = seconds - 60
	end
		if seconds < 10 then
		seconds = "0"..seconds
	end
		if(getPlayerStorageValue(cid, storage) > os.time()) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You can use in : "..minutes..":"..seconds..".")
	    else
		  doTeleportThing(cid, config.houseInfo.entry)
		setPlayerStorageValue(cid, storage, os.time() + exhausted)
		end
return true
end
 
Back
Top