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

modules

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
LUA:
	function StdModule.travel(cid, message, keywords, parameters, node)
		local npcHandler = parameters.npcHandler
		if(npcHandler == nil) then
			print('[Warning - ' .. getCreatureName(getNpcId()) .. '] NpcSystem:', 'StdModule.travel - Call without any npcHandler instance.')
			return false
		end

		if(not npcHandler:isFocused(cid)) then
			return false
		end

		local storage, pzLocked = parameters.storageValue or (EMPTY_STORAGE + 1), parameters.allowLocked or false
		if(parameters.premium and not isPlayerPremiumCallback(cid)) then
			npcHandler:say('I can only allow premium players to travel with me.', 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(parameters.storageId ~= nil and getPlayerStorageValue(cid, parameters.storageId) < storage) then
			npcHandler:say(parameters.storageInfo or 'You may not travel there!', cid)
		elseif(not pzLocked and isPlayerPzLocked(cid)) then
			npcHandler:say('Get out of there with this blood!', cid)
		elseif(not doPlayerRemoveMoney(cid, parameters.cost)) then
			npcHandler:say('You do not have enough money.', cid)
		else
			npcHandler:say('It was a pleasure doing business with you.', cid)
			npcHandler:releaseFocus(cid)

			doTeleportThing(cid, parameters.destination, false)
			doSendMagicEffect(parameters.destination, CONST_ME_TELEPORT)
		end

		npcHandler:resetNpc()
		return true
	end
HOW TO ADD HERE EXAMPLE. doSendMagicEffect(fromposition, CONST_ME_TELEPORT)
if player get travel it make teleport effect from where is like rl
 
Code:
	function StdModule.travel(cid, message, keywords, parameters, node)
		local npcHandler = parameters.npcHandler
		if(npcHandler == nil) then
			print('[Warning - ' .. getCreatureName(getNpcId()) .. '] NpcSystem:', 'StdModule.travel - Call without any npcHandler instance.')
			return false
		end

		if(not npcHandler:isFocused(cid)) then
			return false
		end

		local storage, pzLocked = parameters.storageValue or (EMPTY_STORAGE + 1), parameters.allowLocked or false
		if(parameters.premium and not isPlayerPremiumCallback(cid)) then
			npcHandler:say('I can only allow premium players to travel with me.', 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(parameters.storageId ~= nil and getPlayerStorageValue(cid, parameters.storageId) < storage) then
			npcHandler:say(parameters.storageInfo or 'You may not travel there!', cid)
		elseif(not pzLocked and isPlayerPzLocked(cid)) then
			npcHandler:say('Get out of there with this blood!', cid)
		elseif(not doPlayerRemoveMoney(cid, parameters.cost)) then
			npcHandler:say('You do not have enough money.', cid)
		else
			npcHandler:say('It was a pleasure doing business with you.', cid)
			npcHandler:releaseFocus(cid)

			local p = getThingPos(cid)
			doTeleportThing(cid, parameters.destination, false)
			doSendMagicEffect(p, CONST_ME_TELEPORT)
			doSendMagicEffect(parameters.destination, CONST_ME_TELEPORT)
		end

		npcHandler:resetNpc()
		return true
	end
 
Back
Top