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

Lua Helps me edit a script?

avastsz2856

New Member
Joined
Jul 9, 2017
Messages
15
Reaction score
1
So I wanted help for a script like this ..

Let's suppose you have an actionID that only people who have guild can pass ..
And the person who does not have guild can not pass in that actionID and receive a msg "you do not have guild"

For tfs 1.2
Thank you.
 
Solution
Not sure if im understanding you right but this is what it shoudl look like.

Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        player:teleportTo(fromPosition, false)
        player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
        return
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:sendTextMessage(20, "[Castle of Honor] Voce e sua guild estao no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")...
getPlayerGuildId(cid)

Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        player:teleportTo(fromPosition, false)
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:sendTextMessage(20, "[Castle of Honor] Voce e sua guild estao no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estao agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)

He would have to see this message, but he does not come back ... what happens?
Lua:
player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
 
Not sure if im understanding you right but this is what it shoudl look like.

Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        player:teleportTo(fromPosition, false)
        player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
        return
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:sendTextMessage(20, "[Castle of Honor] Voce e sua guild estao no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estao agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
        end
    end
    return true
end
 
Last edited:
Solution
Not sure if im understanding you right but this is what it shoudl look like.

Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        player:teleportTo(fromPosition, false)
        player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
        return
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:sendTextMessage(20, "[Castle of Honor] Voce e sua guild estao no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estao agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
        end
    end
    return true
end

Thanks
 
Back
Top