• 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 Logout On accept

marcos16

Falkhonn
Joined
May 4, 2012
Messages
224
Reaction score
1
Hello OtLanders.
Well, I have a script that needs some modifications ... So I need someone to do this ... Follow the script below

Code:
local config = {
    itemid = 5957,
    storage1 = 224413
}

function onSay(cid, words, param, param2, channel)
    if param == '' then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
        return false
    end
   
    local t = string.explode(param, ",")
    local creature = getCreatureByName(t[1])
    if not creature and isPlayer(creature) and not isPlayerGhost(creature) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
        return false
    end
   
    if os.time() > getPlayerStorageValue(cid, config.storage1) then
        local days = tonumber(t[2])
        if days < 2 then
            doPlayerSendCancel(cid, "O mínimo que você pode transferir é de 2 dias.")
            return false
        end
        if days and type(days) == 'number' and getPlayerPremiumDays(cid) - 2 >= days then
            doStartTrade(cid, creature, doPlayerAddItem(cid, config.itemid, 1))
            doPlayerSendTextMessage(creature, MESSAGE_INFO_DESCR, "O Jogador " .. getPlayerName(cid) .. " deu trade em você, e está disposto a trocar " .. days .. " dia(s) de VIP.")
            setPlayerStorageValue(cid, config.storage1, days)
        else
            doPlayerSendCancel(cid, "Você não pode transferir essa quantidade de VIP.")
        end
       
    end
   
    return false
end


What I wanted to change is to use the command only in protection zone, to be without battle and to dislodge when accepting the trade ... Could anyone do this? REP ++
 
Code:
    local pos = getThingPosition(cid)

    local tile_info = getTileInfo(pos)
    if (tile_info.protection or tile_info.nopvp or tile_info.nologout or tile_info.house or tile_info.hardcore) then
        return doPlayerSendCancel(cid, "Cannot be used in special zones!")
    end

or

Code:
  if (getCreatureCondition(cid,CONDITION_INFIGHT)) then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You can't use this while you are in battle.")
        return true
    end

or
Code:
    if (getCreatureCondition(cid,CONDITION_INFIGHT)) or (isPlayerPzLocked(cid)) then
        doPlayerSendTextMessage(cid,MESSAGE_TYPES["green"],"You can't use this while you are in battle or protection zone.")
        return true
    end

u can add any cod after function onSay
 
Back
Top