• 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] Ban offline players

Syryniss

Member
Joined
Feb 13, 2014
Messages
206
Reaction score
20
Hi. I made a /ban talkaction with help of few similar scripts which I found on forum. I have a question, is it possible to edit it, so I can ban offline people, because now it works only with online players. I'm using TFS 0.3.6.

Here is script:
Code:
local default_comment = ""
local default_lenght = 12

function onSay(cid, words, param)
    local parametres = string.explode(param, ",")
    if(parametres[1] ~= nil) then
        local accId = getAccountIdByName(parametres[1])
        local pId = getPlayerGUIDByName(parametres[1])
        if(accId > 0) then
            local lenght = default_lenght
            local comment = default_comment
            local player = getPlayerByNameWildcard(parametres[1])
            local message = parametres[1] .. " has been banished for " .. lenght .. " hour(s)."
            if(isPlayer(player) and getPlayerAccess(player) < getPlayerAccess(cid)) then 
                if(parametres[2] ~= nil and tonumber(parametres[2]) > 0) then
                    lenght = tonumber(parametres[2])
                    message = parametres[1] .. " has been banished for " .. lenght .. " hour(s)."
                end
                if(parametres[3] ~= nil) then
                    comment = parametres[3]
                    message = parametres[1] .. " has been banished for " .. lenght .. " hour(s) with commment: " .. comment
                end
                doAddAccountBanishment(accId, pId, os.time() + (3600 * lenght), 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
                doBroadcastMessage(message, MESSAGE_TYPES[warning])
                if(isPlayer(player) == TRUE) then
                    doRemoveCreature(player)
                end
            else 
                doPlayerSendCancel(cid, "You cannot ban this player.")
            end
        else
            doPlayerSendCancel(cid, "Player with name " .. parametres[1] .. " doesn't exist.")
        end
    else
        doPlayerSendCancel(cid, "You must enter name.")
    end
    return true
end
 
Back
Top