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

Time in minutes right!

icaro1988

New Member
Joined
Jul 1, 2009
Messages
63
Reaction score
1
I need to put that script in minutes the time for the player to get through the place again!

LUA:
function onStepIn(cid, item, pos)
pos = {{x=313, y=241, z=7},{x=321, y=252, z=7},{x=315, y=267, z=7}}
time_go = 60
storage_invasion = 9549

if getPlayerStorageValue(cid,storage_invasion) + (time_go) <= os.time() and item.actionid == 5081 then
      local randomChance = math.random(1, 3)
       doTeleportThing(cid,pos[randomChance])
       doSendMagicEffect(pos[randomChance],12)
       setPlayerStorageValue(cid,storage_invasion,os.time())
else
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You can only enter the area of invasion, hence the ".. (getPlayerStorageValue(cid, storage_invasion)-os.time()+(time_go)) .." seconds.")
	   
end
end

I'll have to appear but not the second most minutes remaining when he is stepping on this site!
 
Last edited:
LUA:
local p,t,s = {{x=313, y=241, z=7},{x=321, y=252, z=7},{x=315, y=267, z=7}},60,9549 -- pos,time,storage
local r = pos[math.random(1,3)]
function onStepIn(cid, item, position, fromPosition)
	if exhaustion.check(cid,s) then
		return doPlayerSendCancel(cid,'You can enter again in '..exhaustion.get(cid,s)..' seconds.') and false
	else
		doTeleportThing(cid,r)
		doSendMagicEffect(r,CONST_ME_MAGIC_BLUE)
		exhaustion.set(cid,s,t)
	end
	return true
end

Implying you have TFS 0.3.x
 
I need to put that script in minutes the time for the player to get through the place again!


I'll have to appear but not the second most minutes remaining when he is stepping on this site!

@ unknown

I am afraid you didnt make what he want, I think he said he want it to show in a minute way .
 
So a player may enter in only 60 minutes?
Sorry for misunderstanding but I didn't understand your English.

LUA:
local p,t,s = {{x=313, y=241, z=7},{x=321, y=252, z=7},{x=315, y=267, z=7}},60*60*1000,9549 -- pos,time,storage
local r = pos[math.random(1,3)]
function onStepIn(cid, item, position, fromPosition)
	if exhaustion.check(cid,s) then
		if exhaustion.get(cid,s) <= 60 then
			return doPlayerSendCancel(cid,'You can enter again in '..exhaustion.get(cid,s)..' seconds.') and false
		else
			return doPlayerSendCancel(cid,'You can enter again in '..exhaustion.get(cid,s/60/1000)..' minutes.' and false
		end
	else
		doTeleportThing(cid,r)
		doSendMagicEffect(r,CONST_ME_MAGIC_BLUE)
		exhaustion.set(cid,s,t)
	end
	return true
end
 
@up
Storage value /60 /1000 ? xD and maybe... math.ceil(x) to show time in minutes

Resolved with Math.ceil (x) follows the script below and soon after the result!

LUA:
function onStepIn(cid, item, pos)
pos = {{x=313, y=241, z=7},{x=321, y=252, z=7},{x=315, y=267, z=7}}
time_go = 30 * 60
storage_invasion = 9549

if getPlayerStorageValue(cid,storage_invasion) + (time_go) <= os.time() and item.actionid == 5081 then
      local randomChance = math.random(1, 3)
       doTeleportThing(cid,pos[randomChance])
       doSendMagicEffect(pos[randomChance],12)
       setPlayerStorageValue(cid,storage_invasion,os.time())
else
	   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You can only enter the area of invasion, hence the ".. math.ceil((getPlayerStorageValue(cid, storage_invasion)-os.time()+(time_go))/60) .." minutes.")
	   
end
end

With the math.ceil() Returns: 23:52 You can only enter the area of invasion, hence the 14 minutes.

Without the math.ceil() return: 23:52 You can only enter the area of invasion, hence the 12.966666666667 minutes.

Thanks PhoOwned, Thanks to everyone who tried to help too! Perfect script now

Rep ++
 
Last edited:
ay yea lol :p , you can make it

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	local pos = {{x=313, y=241, z=7},{x=321, y=252, z=7},{x=315, y=267, z=7}}
	local time_go = 1   --- in minutes
	local storage_invasion = 9549
 
	if getPlayerStorageValue(cid,storage_invasion) <= os.time() and item.actionid == 5081 then
		local randomChance = math.random(1, 3)
		doTeleportThing(cid,pos[randomChance])
		doSendMagicEffect(pos[randomChance],12)
		setPlayerStorageValue(cid,storage_invasion,os.time() + (time_go *60) )
	else
		doTeleportThing(cid,fromPosition,false)
		doSendMagicEffect(fromPosition,2)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You can only enter the area of invasion, hence after "..os.date("%M minutes, %S seconds.",getPlayerStorageValue(cid,storage_invasion)).."")
	end
	
return true
end
 
Back
Top