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

Action Teleport Book, If have PZ = NO TP.

Ekt

New Member
Joined
Sep 11, 2011
Messages
58
Reaction score
0
Location
127.0.0.1
Well I am making a simple scripts, please correct me if I am wrong:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Tienes que esperar a que la PZ se vaya MENSO!.")
	return TRUE
end	

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), TRUE)
doPlayerSendTextMessage(cid, 25, "Ya te teletransportaste a la cama de un homosexual, corre!")
		 doSendMagicEffect(getCreaturePosition(cid), 10)
	return true
end

XML
Lua:
	<action itemid="ITEMID" event="script" value="telebook.lua" allowfaruse="1"/>
Comment Please!
 
Well I am making a simple scripts, please correct me if I am wrong:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Tienes que esperar a que la PZ se vaya MENSO!.")
	return TRUE
end	

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), TRUE)
doPlayerSendTextMessage(cid, 25, "Ya te teletransportaste a la cama de un homosexual, corre!")
		 doSendMagicEffect(getCreaturePosition(cid), 10)
	return true
end

XML
Lua:
	<action itemid="ITEMID" event="script" value="telebook.lua" allowfaruse="1"/>
Comment Please!

change :
Lua:
if hasCondition(cid, CONDITION_INFIGHT) == TRUE then

to :
Lua:
if isPlayerPzLocked(cid) == TRUE then

so that if player is hunting he can tp himself and only not allowed if pking
 
@up
Lua:
if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
is same as
Lua:
if isPlayerPzLocked(cid) == TRUE then
just with condition is better.
 
There's no place like 127.0.0.1
You can't get PZ, it's area effect.
 
Can you make it with time?
You press the book and You have to whait 30 seconds or 5 minutes ;). With timer script, please?
 
Can you make it with time?
You press the book and You have to whait 30 seconds or 5 minutes ;). With timer script, please?


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local exhausted_seconds = 5 -- seconds
local exhausted_storagevalue = 910000

   if os.time() < getPlayerStorageValue(cid, exhausted_storagevalue) then
   doPlayerSendTextMessage(cid,22,"You can only use this book once every "..exhausted_seconds.." second"..(exhausted_seconds > 1 and 's' or '').."."..((getPlayerStorageValue(cid, exhausted_storagevalue) - os.time()) == 1 and ' 1 second left.' or (getPlayerStorageValue(cid, exhausted_storagevalue) - os.time()) > 1 and ' '..(getPlayerStorageValue(cid, exhausted_storagevalue) - os.time())..' seconds left.' or '').."")
   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   return TRUE
   end
   
   if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
   doPlayerSendTextMessage(cid, 22, "Wait, you have a battle sign.")
   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   return TRUE
   end	

   doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), TRUE)
   doPlayerSendTextMessage(cid, 25, "You have been teleported to temple "..getTownName(getPlayerTown(cid))..".")
   doSendMagicEffect(getCreaturePosition(cid), 10)
   setPlayerStorageValue(cid, exhausted_storagevalue , os.time() + exhausted_seconds)
   return true
end
 
Take it :)

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local seconds = 60 
local storage = 44555 

if(getPlayerStorageValue(cid,storage) < os.time()) then
	if (isPlayerPzLocked(cid) ~= true) then	
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), TRUE)
		doPlayerSendTextMessage(cid, 25, "Teleport done to: "..getTownName(getPlayerTown(cid))..".")
		doSendMagicEffect(getCreaturePosition(cid), 10)
		setPlayerStorageValue(cid, storage , os.time() + seconds)
	else
		doPlayerSendCancel(cid, "You cant use this item if you have PZ Locked.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
else
	doPlayerSendCancel(cid, "You need wait "..getPlayerStorageValue(cid,storage) - os.time().." seconds.")
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)	
end


return true
end
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local exhausted_seconds = 5 -- seconds
local exhausted_storagevalue = 910000

   if os.time() < getPlayerStorageValue(cid, exhausted_storagevalue) then
   doPlayerSendTextMessage(cid,22,"You can only use this book once every "..exhausted_seconds.." second"..(exhausted_seconds > 1 and 's' or '').."."..((getPlayerStorageValue(cid, exhausted_storagevalue) - os.time()) == 1 and ' 1 second left.' or (getPlayerStorageValue(cid, exhausted_storagevalue) - os.time()) > 1 and ' '..(getPlayerStorageValue(cid, exhausted_storagevalue) - os.time())..' seconds left.' or '').."")
   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   return TRUE
   end
   
   if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
   doPlayerSendTextMessage(cid, 22, "Wait, you have a battle sign.")
   doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   return TRUE
   end	

   doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), TRUE)
   doPlayerSendTextMessage(cid, 25, "You have been teleported to temple "..getTownName(getPlayerTown(cid))..".")
   doSendMagicEffect(getCreaturePosition(cid), 10)
   setPlayerStorageValue(cid, exhausted_storagevalue , os.time() + exhausted_seconds)
   return true
end

Take it :)

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local seconds = 60 
local storage = 44555 

if(getPlayerStorageValue(cid,storage) < os.time()) then
	if (isPlayerPzLocked(cid) ~= true) then	
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), TRUE)
		doPlayerSendTextMessage(cid, 25, "Teleport done to: "..getTownName(getPlayerTown(cid))..".")
		doSendMagicEffect(getCreaturePosition(cid), 10)
		setPlayerStorageValue(cid, storage , os.time() + seconds)
	else
		doPlayerSendCancel(cid, "You cant use this item if you have PZ Locked.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
else
	doPlayerSendCancel(cid, "You need wait "..getPlayerStorageValue(cid,storage) - os.time().." seconds.")
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)	
end


return true
end

Thanks a lot!
 
Back
Top