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

TalkAction Teleportation Spell

Chris

Inactive
Senator
Joined
Aug 11, 2008
Messages
2,628
Solutions
2
Reaction score
240
Hello guys.
I decided to release a few of my scripts ( Training Booths , Vocation Booths , Teleportatin Spell ). These scripts were only tested on TFS Alpha 3.

Teleportatin Spell
This script is pretty easy to configure. All you really have to do is to modify and add new rows which looks like this:

["train"] = {x = 820, y = 962, z = 7, name = "Thais Training Booths", access = 1, level = 60, vip = true, cost = 2000, soul = 2},

["train"] = What you type to go there.
x, y, z = The positions of the new place.
name = The name of the new place.
access = What access is necessary to go there.
level = What level is necessary to go there.
vip = Check if the user is VIP (vocations 9,10,11,12) or not.
cost = How much money should it drain from the user.
soul = How many soulpoints should it drain from the user.


If an area is defined by gm ( ["gm"] ) and someone uses it, a small window will appear welcoming you to the gm island.



data/functions.lua
PHP:
function isVIP(cid)
    if(isPlayer(cid) == FALSE) then
        debugPrint("isVIP: Player not found.")
        return false
    end

    return (isInArray({9,10,11,12}, getPlayerVocation(cid)) == TRUE)
end


data/talkactions/scripts/
teleport.lua

PHP:
function onSay(cid, words, param)

    -- Define possible teleport locations.
    local teleport =
    {
        -- For regular players.
        ["depot"]    = {x = 770, y = 997, z = 7, name = "Thais Depot", access = 1, level = 80, vip = false, cost = 3000, soul = 1},
        ["temple"]    = {x = 793, y = 1014, z = 7, name = "Thais Temple", access = 1, level = 80, vip = false, cost = 3000, soul = 1},
        ["train"]    = {x = 820, y = 962, z = 7, name = "Thais Training Booths", access = 1, level = 60, vip = true, cost = 2000, soul = 2},
        -- 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 GM 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 VIP.
                    if ( teleport[param].vip == true and isVIP(cid) ) or teleport[param].vip == false then
                    
                        -- 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 a player with VIP privileges 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 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
data/talkactions/talkactions.xml
PHP:
    <!-- Teleport -->
    <talkaction filter="word" words="goto" script="teleport.lua"/>
There you go, have fun with it.
 
Yeah thanks, what I forgot to mention though, is that the player has to be free of any combat sign or else he won't be able to use the teleportation spell.
 
Umm, Naruto already released this here.
Mainly a copy.

I use his, and it works for tfs.
 
Umm, I wasn't aware of that? Besides, people release things which has already been released all over again. It's just a way of life.
 
Is good, but doesnt take money... and doesnt check PZ.

You can easily do this by changing
Code:
-- 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)
to
Code:
-- Check if player is PZ Locked
if(isPlayerPzLocked(cid) == FALSE) then
    -- Make sure money is removed {change 1234 to amount to remove}
    if(doPlayerRemoveMoney(cid, 1234) == TRUE) 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)
    end
end

Jo3
 
Thats cool, but possible to make teleportation spell with tp's you 1-2 sqms to forward?

Please reply!
 
Back
Top