• 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 Players higher than level xx can tp players lower than xx to temple

ghettobird

LUA newbie
Joined
Aug 17, 2013
Messages
679
Reaction score
132
Location
OTland
Hello OTland, today as the title says I will be introducing my latest script & explaining how helpful it might be...


Alright so imagine you are in a war and you find someone lower than level 100 (so you can't attack him) and he is mwalling all over the place, or even blocking your way so others can SD you and you can't do anything but heal... Quite frustrating ain't it?

So I came up with this talkaction so you can tp that player to temple BUT you need to be more than level 100 (obviously...) and he has to be lower than level 100 AND has to be in a NON PZ zone, that was he may be blocking you


So first go to talkactions/scripts & add this
Code:
local config = {
exhaustionInSeconds = 400,
storage = 36532
}
function onSay(cid, words, param)
local player = getPlayerByName(param)
if(param == '') then
doPlayerSendTextMessage(cid, 22, "Command requires param.")
return true
end
if(isPlayer(player) == FALSE) then
doPlayerSendTextMessage(cid, 22, "This players is offline, or doesnt exist.")
return TRUE
end
if(getPlayerLevel(player) >= 100) then
doPlayerSendTextMessage(cid, 22, "That guy's level is more than 100 -.-'")
return TRUE
end
if(getPlayerLevel(cid) < 100) then
doPlayerSendTextMessage(cid, 22, "Your not even level 100... Go hide in temple")
return TRUE
end
if(getPlayerSoul(cid) < 40) then
doPlayerSendTextMessage(cid, 22, "You need 40 soul points to teleport people.")
return TRUE
end
local pos = getPlayerPosition(player)
if(getTilePzInfo(pos) == TRUE) then
doPlayerSendTextMessage(cid, 22, "You can't teleport this player because he is in PZ zone.")
return TRUE
end
if(exhaustion.check(cid, config.storage) == TRUE) then
doPlayerSendTextMessage(cid, 22, "You can teleport players only one time per " .. config.exhaustionInSeconds .. " seconds.")
return TRUE
end
if(isPlayer(player) == TRUE) then
exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
doPlayerSendTextMessage(player, 22, 'You have been teleported to temple by '.. getPlayerName(cid) ..'.')
doPlayerSendTextMessage(cid, 22, 'You succesfully teleported '.. getPlayerName(player) ..' to temple.')
doPlayerAddSoul(cid, -100)
return TRUE
end
return TRUE
end


Now go to talkactions.xml and add this
Code:
<talkaction log="no" words="!tp" access="0" event="script" value="tpnoobs.lua"/>


Your done :) Rep me? ;)
 
Has anyone tested it yet?

Next time, tab. This looks just terrible :/

Code:
local config = {
    exhaustionInSeconds = 400,
    storage = 36532
}

function onSay(cid, words, param)
    local player = getPlayerByName(param)
    if(param == '') then
        doPlayerSendTextMessage(cid, 22, "Command requires param.")
        return true
    end
    if(isPlayer(player) == FALSE) then
        doPlayerSendTextMessage(cid, 22, "This players is offline, or doesnt exist.")
        return TRUE
    end
    if(getPlayerLevel(player) >= 100) then
        doPlayerSendTextMessage(cid, 22, "That guy's level is more than 100 -.-'")
        return TRUE
    end
    if(getPlayerLevel(cid) < 100) then
        doPlayerSendTextMessage(cid, 22, "Your not even level 100... Go hide in temple")
        return TRUE
    end
    if(getPlayerSoul(cid) < 40) then
        doPlayerSendTextMessage(cid, 22, "You need 40 soul points to teleport people.")
        return TRUE
    end
    local pos = getPlayerPosition(player)
        if(getTilePzInfo(pos) == TRUE) then
        doPlayerSendTextMessage(cid, 22, "You can't teleport this player because he is in PZ zone.")
        return TRUE
    end
    if(exhaustion.check(cid, config.storage) == TRUE) then
        doPlayerSendTextMessage(cid, 22, "You can teleport players only one time per " .. config.exhaustionInSeconds .. " seconds.")
        return TRUE
    end
    if(isPlayer(player) == TRUE) then
        exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
        doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
        doPlayerSendTextMessage(player, 22, 'You have been teleported to temple by '.. getPlayerName(cid) ..'.')
        doPlayerSendTextMessage(cid, 22, 'You succesfully teleported '.. getPlayerName(player) ..' to temple.')
        doPlayerAddSoul(cid, -100)
        return TRUE
    end
    return TRUE
end
 
Has anyone tested it yet?

Also make it easier to configuration.

Code:
local config = {
    exhaustionInSeconds = 400,
    minLevel = 100,
    minSoul = 40,
    storage = 36532
}

function onSay(cid, words, param)
    local player = getPlayerByName(param)
    if(param == '') then
        doPlayerSendTextMessage(cid, 22, "Command requires param.")
        return true
    end
    if(isPlayer(player) == FALSE) then
        doPlayerSendTextMessage(cid, 22, "This players is offline, or doesnt exist.")
        return TRUE
    end
    if(getPlayerLevel(player) >= config.minLevel) then
        doPlayerSendTextMessage(cid, 22, "That guy's level is more than "..config.minLevel.." -.-'")
        return TRUE
    end
    if(getPlayerLevel(cid) < config.minLevel) then
        doPlayerSendTextMessage(cid, 22, "Your not even level 100... Go hide in temple")
        return TRUE
    end
    if(getPlayerSoul(cid) < config.minSoul) then
        doPlayerSendTextMessage(cid, 22, "You need "..config.minSoul.." soul points to teleport people.")
        return TRUE
    end
    local pos = getPlayerPosition(player)
        if(getTilePzInfo(pos) == TRUE) then
        doPlayerSendTextMessage(cid, 22, "You can't teleport this player because he is in PZ zone.")
        return TRUE
    end
    if(exhaustion.check(cid, config.storage) == TRUE) then
        doPlayerSendTextMessage(cid, 22, "You can teleport players only one time per " .. config.exhaustionInSeconds .. " seconds.")
        return TRUE
    end
    if(isPlayer(player) == TRUE) then
        exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
        doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
        doPlayerSendTextMessage(player, 22, 'You have been teleported to temple by '.. getPlayerName(cid) ..'.')
        doPlayerSendTextMessage(cid, 22, 'You succesfully teleported '.. getPlayerName(player) ..' to temple.')
        doPlayerAddSoul(cid, -100)
        return TRUE
    end
    return TRUE
end
 
What if some poor guy is trying to hunt and a high level just comes and tp's him back to temple? :(
We all know it takes forever to walk to a spawn when you're a low level and that could be devastating :O!

Why not make the following changes:
1. Make players below the protection level walkthroughable (player.cpp edit here)
2. Increase the level to use exura sio, exura gran mas res, and UH to level 100
3. Increase the level to use Magic wall and Wild Growth to level 100
 
Making players walkthroughable is okay but what if they are in dp? then you gotta add another script and give each tile in dp a unique id so only 1 player can walk on it...

I think i will edit it so that if they got PZ lock they can't be teleported :p
 
What do you mean? Usually all players are walkthroughable in safe zones except for depot tiles. The source edit will not make them walkthroughable on depot tiles.
 
I just tested it with my linux... It made players walkthroughable in depot tiles :)

Anyways, When I have some time ill add it so if you are hunting they can't teleport you
 
That's weird because I have it on my server for the past 2.5 months and it's been working flawlessly. Which TFS version are you using?

If you make it so when they have a battle symbol they can't be teleported then even if they shoot a magic wall rune they will have battle symbol right? Then that will defeat the purpose of trying to teleport someone below protection level that's magic walling you.
 
true, i just noticed that :p so this script will work as a 2nd solution if someone can't edit his player.cpp file... Also I'm using tfs 0.4
 
Back
Top