function StdModule.travel(cid, message, keywords, parameters, node)
local npcHandler = parameters.npcHandler
if(npcHandler == nil) then
error("StdModule.travel called without any npcHandler instance.")
end
if(not npcHandler:isFocused(cid)) then
return false
end
if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
if(isPlayerPzLocked(cid)) then
npcHandler:say("First get rid of those blood stains! You are not going to ruin my vehicle!", cid)
elseif(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then
npcHandler:say("You must reach level " .. parameters.level .. " before I can let you go there.", cid)
elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
npcHandler:say("You don't have enough money.", cid)
else
npcHandler:say(parameters.msg or "Set the sails!", cid)
npcHandler:releaseFocus(cid)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, parameters.destination)
doSendMagicEffect(parameters.destination, CONST_ME_TELEPORT)
end
else
npcHandler:say("I'm sorry, but you need a premium account in order to travel onboard our ships.", cid)
end
npcHandler:resetNpc()
return true
end
local config = {
storage = 8034,
time = 3600,
fromPos = {x=92, y=114, z=7},
toPos = {x=98, y=120, z=7},
backPos = {x=94, y=122, z=7}
}
local function doKickPlayer(cid)
if not isPlayer(cid) then
return true
end
if isInRange(getPlayerPosition(cid), config.fromPos, config.toPos) then
doTeleportThing(cid, config.backPos)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Time is up!")
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.storage) >= os.time() then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition)
local m = math.floor((getPlayerStorageValue(cid, config.storage) - os.time()) / 60) > 0 and math.floor((getPlayerStorageValue(cid, config.storage) - os.time()) / 60) or 1
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You have "..m.." "..(m == 1 and "minute" or "minutes").." left to hunt in the spawn.")
addEvent(doKickPlayer, m * 60 * 1000, cid)
elseif doPlayerRemoveItem (cid, 2160, 1) then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You have now entered some spawn, you can hunt here for 1 hour.")
addEvent(doKickPlayer, config.time * 1000, cid)
setPlayerStorageValue(cid, config.storage, os.time() + config.time)
else
doPlayerSendCancel(cid, "You need 1 cc to enter.")
end
return true
end
local config = {
storage = 8034,
time = 3600,
fromPos = {x=92, y=114, z=7},
toPos = {x=98, y=120, z=7},
backPos = {x=94, y=122, z=7}
}
local function doKickPlayer(cid)
if not isPlayer(cid) then
return true
end
if isInRange(getPlayerPosition(cid), config.fromPos, config.toPos) then
doTeleportThing(cid, config.backPos)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Time is up!")
end
return true
end
if isInRange(getPlayerPosition(cid), config.fromPos, config.toPos) then
if getPlayerStorageValue(cid, config.storage) < os.time() then
doTeleportThing(cid, config.backPos)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING,"Time is up!")
else
local m = math.floor((getPlayerStorageValue(cid, config.storage) - os.time()) / 60) > 0 and math.floor((getPlayerStorageValue(cid, config.storage) - os.time()) / 60) or 1
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You have "..m.." "..(m == 1 and "minute" or "minutes").." left to hunt in the spawn.")
addEvent(doKickPlayer, m * 60 * 1000, cid)
end
end