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

REP++ FOR SOMEOINE WHO HELPs

GBR Jessica

New Member
Joined
Nov 27, 2008
Messages
48
Reaction score
0
I found a !goto for normal players and vip
But i need one that you can either change it to be normal player or Premium (not vip)
Need a basic script where i can add locations to
Can you include a location for example
!goto depot (normal players and prem)
!PREMgoto premium depot (for premium only)
 
Last edited:
Code:
 function onSay(cid, words, param)

-- Define possible teleport locations.
local teleport =
{
-- For regular players.
["depot"] = {x = 774, y = 648, z = 7, name = "Toren Depot", access = 1, level = 1, premium = true, cost = 0, soul = 0},
["mall"] = {x = 801, y = 652, z = 7, name = "Toren Mall", access = 1, level = 1, premium = true, cost = 0, soul = 0},
["iteos"] = {x = 1764, y = 2030, z = 7, name = "Aeneus", access = 1, level = 1, premium = true, cost = 0, soul = 0},
["trainers"] = {x = 464, y = 769, z = 7, name = "Trainers", access = 1, level = 1, premium = false, cost = 0, soul = 0},

-- For gamemasters.
["gm"] = {x = 1298, y = 897, z = 7, access = 4}
}

-- Check so the param is not nil.
if param ~= nil then

-- Check if param exists in table teleports.
if table.find(teleport, teleport[param]) then

-- Check what access is required for the new destination.
if teleport[param].access > 1 or getPlayerAccess(cid) >= teleport[param].access then

-- Check if the player has access above ordinary.
if getPlayerAccess(cid) >= teleport[param].access then

-- Check if the player has gone to the GM Island.
if param == "gm" then

-- Define character greeting.
if getPlayerSex(cid) == 0 then
greeting = "Miss"
else
greeting = "Mister"
end

-- Show a popup window.
doPlayerPopupFYI(cid, "Welcome to the Staff Island, " .. greeting .. " " .. getPlayerName(cid) .. ".")

end

-- Teleport player to the wanted location.
doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 10)

end

else

-- Check if the player has the required level.
if getPlayerLevel(cid) >= teleport[param].level then

-- Check if the player has Premium.
if ( teleport[param].isPremium(cid) == TRUE) ) or teleport[param].isPremium(cid) == FALSE

-- Check if the player has enough money on him.
if doPlayerRemoveMoney(cid, teleport[param].cost) == TRUE then

-- Check if the player has enough soulpoints.
if getPlayerSoul(cid) >= teleport[param].soul then

-- Remove soulpoints from the player.
doPlayerAddSoul(cid, - teleport[param].soul)

-- Check if the player is in a fight or not.
if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then

-- Teleport the player to the wanted location.
doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 10)

else

-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You may not be in a fight while trying to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)

end

else

-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You do not have enough soulpoints (" .. teleport[param].soul .. ") to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)

end

else

-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You do not have enough money (" .. teleport[param].cost .. "gp) to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)

end

else

-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You need to be premium to go to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)

end

else

-- Send an error message.
doPlayerSendTextMessage(cid, 23, "You need to be atleast level " .. teleport[param].level .. " to alter your destination to " .. teleport[param].name .. ".")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)

end

end

else

-- Send an error message.
doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)

end

else

-- Send an error message.
doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
-- Send magic effect.
doSendMagicEffect(getCreaturePos(cid), 2)

end

end
Got this so far doesnt work :S
 
PHP:
local teleport =
{
	["depot"] = {x = 774, y = 648, z = 7, name = "Toren Depot", access = 1, level = 1, premium = true, cost = 0, soul = 0},
	["mall"] = {x = 801, y = 652, z = 7, name = "Toren Mall", access = 1, level = 1, premium = true, cost = 0, soul = 0},
	["iteos"] = {x = 1764, y = 2030, z = 7, name = "Aeneus", access = 1, level = 1, premium = true, cost = 0, soul = 0},
	["trainers"] = {x = 464, y = 769, z = 7, name = "Trainers", access = 1, level = 1, premium = false, cost = 0, soul = 0},
	
	["gm"] = {x = 1298, y = 897, z = 7, access = 4}
}
if param ~= nil then
	
	if table.find(teleport, teleport[param]) then
		if teleport[param].access > 1 or getPlayerAccess(cid) >= teleport[param].access then
			if getPlayerAccess(cid) >= teleport[param].access then
				if param == "gm" then
					if getPlayerSex(cid) == 0 then
						greeting = "Miss"
					else
						greeting = "Mister"
					end
					
					doPlayerPopupFYI(cid, "Welcome to the Staff Island, " .. greeting .. " " .. getPlayerName(cid) .. ".")
					
				end
				
				doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
				doSendMagicEffect(getCreaturePos(cid), 10)
				
			end
			
		else
			if getPlayerLevel(cid) >= teleport[param].level then
				if (isPremium(cid) == teleport[param].premium)
					if doPlayerRemoveMoney(cid, teleport[param].cost) == TRUE then
						if getPlayerSoul(cid) >= teleport[param].soul then
							doPlayerAddSoul(cid, - teleport[param].soul)
							if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then
								doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
								doSendMagicEffect(getCreaturePos(cid), 10)
								
							else
								doPlayerSendTextMessage(cid, 23, "You may not be in a fight while trying to alter your destination to " .. teleport[param].name .. ".")
								doSendMagicEffect(getCreaturePos(cid), 2)
								
							end
							
						else
							doPlayerSendTextMessage(cid, 23, "You do not have enough soulpoints (" .. teleport[param].soul .. ") to alter your destination to " .. teleport[param].name .. ".")
							doSendMagicEffect(getCreaturePos(cid), 2)
							
						end
						
					else
						doPlayerSendTextMessage(cid, 23, "You do not have enough money (" .. teleport[param].cost .. "gp) to alter your destination to " .. teleport[param].name .. ".")
						doSendMagicEffect(getCreaturePos(cid), 2)
						
					end
					
				else
					
					doPlayerSendTextMessage(cid, 23, "You need to be premium to go to " .. teleport[param].name .. ".")
					doSendMagicEffect(getCreaturePos(cid), 2)
					
				end
				
			else
				doPlayerSendTextMessage(cid, 23, "You need to be atleast level " .. teleport[param].level .. " to alter your destination to " .. teleport[param].name .. ".")
				doSendMagicEffect(getCreaturePos(cid), 2)
				
			end
			
		end
		
	else
		doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
		doSendMagicEffect(getCreaturePos(cid), 2)
		
	end
else
	doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
	doSendMagicEffect(getCreaturePos(cid), 2)
	
end

Try this, not tested!
 
PHP:
Warning: Warning: [Event::loadScript] Can not load script. data/talkactions/scripts/teleport.lua
[13/03/2009 17:30:28] data/talkactions/scripts/teleport.lua:34: 'then' expected near 'if'
 
PHP:
local teleport = 
{ 
    ["depot"] = {x = 774, y = 648, z = 7, name = "Toren Depot", access = 1, level = 1, premium = true, cost = 0, soul = 0}, 
    ["mall"] = {x = 801, y = 652, z = 7, name = "Toren Mall", access = 1, level = 1, premium = true, cost = 0, soul = 0}, 
    ["iteos"] = {x = 1764, y = 2030, z = 7, name = "Aeneus", access = 1, level = 1, premium = true, cost = 0, soul = 0}, 
    ["trainers"] = {x = 464, y = 769, z = 7, name = "Trainers", access = 1, level = 1, premium = false, cost = 0, soul = 0}, 
     
    ["gm"] = {x = 1298, y = 897, z = 7, access = 4} 
} 
if param ~= nil then 
     
    if table.find(teleport, teleport[param]) then 
        if teleport[param].access > 1 or getPlayerAccess(cid) >= teleport[param].access then 
            if getPlayerAccess(cid) >= teleport[param].access then 
                if param == "gm" then 
                    if getPlayerSex(cid) == 0 then 
                        greeting = "Miss" 
                    else 
                        greeting = "Mister" 
                    end 
                     
                    doPlayerPopupFYI(cid, "Welcome to the Staff Island, " .. greeting .. " " .. getPlayerName(cid) .. ".") 
                     
                end 
                 
                doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z}) 
                doSendMagicEffect(getCreaturePos(cid), 10) 
                 
            end 
             
        else 
            if getPlayerLevel(cid) >= teleport[param].level then 
                if (isPremium(cid) == teleport[param].premium) 
                    if doPlayerRemoveMoney(cid, teleport[param].cost) == TRUE  
                        if getPlayerSoul(cid) >= teleport[param].soul then 
                            doPlayerAddSoul(cid, - teleport[param].soul) 
                            if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then 
                                doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z}) 
                                doSendMagicEffect(getCreaturePos(cid), 10) 
                                 
                            else 
                                doPlayerSendTextMessage(cid, 23, "You may not be in a fight while trying to alter your destination to " .. teleport[param].name .. ".") 
                                doSendMagicEffect(getCreaturePos(cid), 2) 
                                 
                            end 
                             
                        else 
                            doPlayerSendTextMessage(cid, 23, "You do not have enough soulpoints (" .. teleport[param].soul .. ") to alter your destination to " .. teleport[param].name .. ".") 
                            doSendMagicEffect(getCreaturePos(cid), 2) 
                             
                        end 
                         
                    else 
                        doPlayerSendTextMessage(cid, 23, "You do not have enough money (" .. teleport[param].cost .. "gp) to alter your destination to " .. teleport[param].name .. ".") 
                        doSendMagicEffect(getCreaturePos(cid), 2) 
                         
                    end 
                     
                else 
                     
                    doPlayerSendTextMessage(cid, 23, "You need to be premium to go to " .. teleport[param].name .. ".") 
                    doSendMagicEffect(getCreaturePos(cid), 2) 
                     
                end 
                 
            else 
                doPlayerSendTextMessage(cid, 23, "You need to be atleast level " .. teleport[param].level .. " to alter your destination to " .. teleport[param].name .. ".") 
                doSendMagicEffect(getCreaturePos(cid), 2) 
                 
            end 
             
        end 
         
    else 
        doPlayerSendTextMessage(cid, 23, "Please use a valid destination.") 
        doSendMagicEffect(getCreaturePos(cid), 2) 
         
    end 
else 
    doPlayerSendTextMessage(cid, 23, "Please use a valid destination.") 
    doSendMagicEffect(getCreaturePos(cid), 2) 
     
end
 
#up
It also won't work

Try this: ;)
Code:
local teleports =
{
	["depot"] = {pos = {x = 774, y = 648, z = 7}, name = "Toren Depot", access = 1, level = 20, soul = 10},
	["mall"] = {pos = {x = 801, y = 652, z = 7}, name = "Toren Mall", access = 1, level = 1, premium = true, cost = 0, soul = 0},
	["iteos"] = {pos = {x = 1764, y = 2030, z = 7}, name = "Aeneus", access = 1, premium = true, cost = 300},
	["trainers"] = {pos = {x = 464, y = 769, z = 7}, name = "Trainers"},

	["gm"] = {pos = {x = 1298, y = 897, z = 7}, access = 4}
}

function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return TRUE
	end

	local teleport = teleports[param]
	if(not teleport) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please use a valid destination.")
		return TRUE
	end

	if(teleport.access and getPlayerAccess(cid) < teleport.access) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enought access for this place.")
		return TRUE
	end

	if(teleport.level and getPlayerLevel(cid) < teleport.level) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to be atleast level " .. teleport.level .. " to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end

	if(teleport.premium and isPremium(cid) ~= TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to be premium to go to " .. teleport.name .. ".")
		return TRUE
	end

	if(teleport.cost and doPlayerRemoveMoney(cid, teleport.cost) ~= TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enough money (" .. teleport.cost .. "gp) to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end

	if(teleport.soul and getPlayerSoul(cid) < teleport.soul) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enough soulpoints (" .. teleport.soul .. ") to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end
	doPlayerAddSoul(cid, - teleport[param].soul)

	if(getCreatureCondition(cid, CONDITION_INFIGHT) ~= 0) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may not be in a fight while trying to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end

	if param == "gm" then
		greeting = "Mister"
		if getPlayerSex(cid) == 0 then
			greeting = "Miss"
		end
	end

	doPlayerPopupFYI(cid, "Welcome to the Staff Island, " .. greeting .. " " .. getPlayerName(cid) .. ".")
	doTeleportThing(cid, teleport.pos)
	doSendMagicEffect(getCreaturePos(cid), CONST_ME_TELEPORT)

	return TRUE
end

When adding new locations, you don't need to use all parameters - you can just add few, which you want.

ex:
["somePlace1"] = {pos = {x = 1298, y = 897, z = 7}, access = 4}
["somePlace2"] = {pos = {x = 123, y = 735, z = 3}, level = 50, cost = 50000}
["somePlace3"] = {pos = {x = 157, y = 46, z = 7}, premium = true, soul = 5}
 
for ^ script
PHP:
[14/03/2009 09:53:47] Lua Script Error: [TalkAction Interface] 
[14/03/2009 09:53:47] data/talkactions/scripts/teleport.lua:onSay

[14/03/2009 09:53:47] data/talkactions/scripts/teleport.lua:47: attempt to index field '?' (a nil value)
[14/03/2009 09:53:47] stack traceback:
[14/03/2009 09:53:47] 	data/talkactions/scripts/teleport.lua:47: in function <data/talkactions/scripts/teleport.lua:11
 
Code:
local teleports =
{
	["depot"] = {pos = {x = 774, y = 648, z = 7}, name = "Toren Depot", access = 1, level = 20, soul = 10},
	["mall"] = {pos = {x = 801, y = 652, z = 7}, name = "Toren Mall", access = 1, level = 1, premium = true, cost = 0, soul = 0},
	["iteos"] = {pos = {x = 1764, y = 2030, z = 7}, name = "Aeneus", access = 1, premium = true, cost = 300},
	["trainers"] = {pos = {x = 464, y = 769, z = 7}, name = "Trainers"},

	["gm"] = {pos = {x = 1298, y = 897, z = 7}, access = 4}
}

function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return TRUE
	end

	local teleport = teleports[param]
	if(not teleport) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please use a valid destination.")
		return TRUE
	end

	if(teleport.access and getPlayerAccess(cid) < teleport.access) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enought access for this place.")
		return TRUE
	end

	if(teleport.level and getPlayerLevel(cid) < teleport.level) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to be atleast level " .. teleport.level .. " to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end

	if(teleport.premium and isPremium(cid) ~= TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to be premium to go to " .. teleport.name .. ".")
		return TRUE
	end

	if(teleport.cost and doPlayerRemoveMoney(cid, teleport.cost) ~= TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enough money (" .. teleport.cost .. "gp) to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end

	if(teleport.soul and getPlayerSoul(cid) < teleport.soul) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enough soulpoints (" .. teleport.soul .. ") to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end

	if(teleport.soul ~= nil) then
		doPlayerAddSoul(cid, -teleport.soul)
	end

	if(getCreatureCondition(cid, CONDITION_INFIGHT) ~= 0) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may not be in a fight while trying to alter your destination to " .. teleport.name .. ".")
		return TRUE
	end

	if param == "gm" then
		greeting = "Mister"
		if getPlayerSex(cid) == 0 then
			greeting = "Miss"
		end
	end

	doPlayerPopupFYI(cid, "Welcome to the Staff Island, " .. greeting .. " " .. getPlayerName(cid) .. ".")
	doTeleportThing(cid, teleport.pos)
	doSendMagicEffect(getCreaturePos(cid), CONST_ME_TELEPORT)

	return TRUE
end

This one works fine for me. Try.

If not - post your teleports.
 
PHP:
local teleport =
{
    ["depot"] = {x = 774, y = 648, z = 7, name = "Toren Depot", access = 1, level = 1, premium = true, cost = 0, soul = 0},
    ["mall"] = {x = 801, y = 652, z = 7, name = "Toren Mall", access = 1, level = 1, premium = true, cost = 0, soul = 0},
    ["iteos"] = {x = 1764, y = 2030, z = 7, name = "Aeneus", access = 1, level = 1, premium = true, cost = 0, soul = 0},
    ["trainers"] = {x = 464, y = 769, z = 7, name = "Trainers", access = 1, level = 1, premium = false, cost = 0, soul = 0},
    
    ["gm"] = {x = 1298, y = 897, z = 7, access = 4}
}
if param ~= nil then
    
    if table.find(teleport, teleport[param]) then
        if teleport[param].access > 1 or getPlayerAccess(cid) >= teleport[param].access then
            if getPlayerAccess(cid) >= teleport[param].access then
                if param == "gm" then
                    if getPlayerSex(cid) == 0 then
                        greeting = "Miss"
                    else
                        greeting = "Mister"
                    end
                    
                    doPlayerPopupFYI(cid, "Welcome to the Staff Island, " .. greeting .. " " .. getPlayerName(cid) .. ".")
                    
                end
                
                doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
                doSendMagicEffect(getCreaturePos(cid), 10)
                
            end
            
        else
            if getPlayerLevel(cid) >= teleport[param].level then
                if (isPremium(cid) == teleport[param].premium) then
                    if doPlayerRemoveMoney(cid, teleport[param].cost) == TRUE then
                        if getPlayerSoul(cid) >= teleport[param].soul then
                            doPlayerAddSoul(cid, - teleport[param].soul)
                            if getCreatureCondition(cid, CONDITION_INFIGHT) == 0 then
                                doTeleportThing(cid, {x = teleport[param].x, y = teleport[param].y, z = teleport[param].z})
                                doSendMagicEffect(getCreaturePos(cid), 10)
                                
                            else
                                doPlayerSendTextMessage(cid, 23, "You may not be in a fight while trying to alter your destination to " .. teleport[param].name .. ".")
                                doSendMagicEffect(getCreaturePos(cid), 2)
                                
                            end
                            
                        else
                            doPlayerSendTextMessage(cid, 23, "You do not have enough soulpoints (" .. teleport[param].soul .. ") to alter your destination to " .. teleport[param].name .. ".")
                            doSendMagicEffect(getCreaturePos(cid), 2)
                            
                        end
                        
                    else
                        doPlayerSendTextMessage(cid, 23, "You do not have enough money (" .. teleport[param].cost .. "gp) to alter your destination to " .. teleport[param].name .. ".")
                        doSendMagicEffect(getCreaturePos(cid), 2)
                        
                    end
                    
                else
                    
                    doPlayerSendTextMessage(cid, 23, "You need to be premium to go to " .. teleport[param].name .. ".")
                    doSendMagicEffect(getCreaturePos(cid), 2)
                    
                end
                
            else
                doPlayerSendTextMessage(cid, 23, "You need to be atleast level " .. teleport[param].level .. " to alter your destination to " .. teleport[param].name .. ".")
                doSendMagicEffect(getCreaturePos(cid), 2)
                
            end
            
        end
        
    else
        doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
        doSendMagicEffect(getCreaturePos(cid), 2)
        
    end
else
    doPlayerSendTextMessage(cid, 23, "Please use a valid destination.")
    doSendMagicEffect(getCreaturePos(cid), 2)
    
end
 
Im surprisingly getting better at Lua
Ty slawkens i rep++ u
But instead of saying
PHP:
"Welcome to the Staff Island, " .. greeting .. " " .. getPlayerName(cid) .. ".")
say
PHP:
"Welcome to the ".. teleport.name ..", " .. greeting .. " " .. getPlayerName(cid) .. ".")
 
Back
Top