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

[0.3.6] Ban.

daneria

New Member
Joined
Dec 24, 2008
Messages
92
Reaction score
0
Location
Poland <3
Hello!
Anyone can do it works for 0.3.6 ?
PHP:
local default_comment = ""
local default_lenght = 1 -- ban time in hours

function onSay(cid, words, param)
    local parametres = string.explode(param, ",")
    if(parametres[1] ~= nil) then
        local accId = getAccountIdByName(parametres[1])
        if(accId > 0) then
            local lenght = default_lenght
            local comment = default_comment
            if(parametres[2] ~= nil and tonumber(parametres[2]) > 0) then
                lenght = tonumber(parametres[2])
            end
            if(parametres[3] ~= nil) then
                comment = parametres[3]
            end
            local player = getPlayerByNameWildcard(parametres[1])
            if(isPlayer(player) == TRUE) then
                doRemoveCreature(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

Orginal - http://otland.net/f81/ban-nick-time-comment-forgotten-server-0-3-4-a-36230/
 
Try this:
Code:
local default_comment = ""
local default_lenght = 1 -- ban time in hours

function onSay(cid, words, param)
    local parametres = string.explode(param, ",")
    if(parametres[1] ~= nil) then
        local accId = getAccountIdByName(parametres[1])
        if(accId > 0) then
            local lenght = default_lenght
            local comment = default_comment
            if(parametres[2] ~= nil and tonumber(parametres[2]) > 0) then
                lenght = tonumber(parametres[2])
            end
            if(parametres[3] ~= nil) then
                reason = parametres[3]
            end
            local player = getPlayerByNameWildcard(parametres[1])
            if(isPlayer(player) == TRUE) then
				doAddBanishment(accId, length, reason)
                doRemoveCreature(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
 
Errors :
PHP:
[Error - Talkaction Interface]
data/talkactions/scripts/ban.lua:onSay
Description:
Data/talkactions/scripts/ban.lua:19: in function <data/talkactions/scripts/ban.lua:4>
 
here try this, idk if it will work but give it a go, also the /ban example
that i placed in there, is the word you use, you only write the name and
the amount of hours to be banned.
Code:
--[[   Example on how to ban the player:
/ban PlayerName, 2 -- the number is in hours ]]--
function onSay(cid, words, param)
    local parametres = string.explode(param, ",")
    if(parametres[1] ~= nil) then
        local accId = getAccountIdByName(parametres[1])
        if(accId > 0) then
            local lenght = default_lenght
            local comment = default_comment
            if(parametres[2] ~= nil and tonumber(parametres[2]) > 0) then
                lenght = tonumber(parametres[2])
            end
            local player = getPlayerByName(parametres[1])
            if(isPlayer(player) == true) then
				doAddBanishment(accId, length)
                doRemoveCreature(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
 
Again errors ;x
PHP:
[Error - Talkactions Interface]
data/talkactions/scripts/ban.lua: onSay
Description:
data/talkactions/ban.lua:15: attempt to call global 'doAddBanishment' ( a nil value)
stack traceback:
data/talkactions/scripts/ban.lua:15: in function <data/talkactions/scripts/ban.lua:3>
 
Wowo this really got me, but try this once more!
Code:
--[[   Example on how to ban the player:
/ban PlayerName, 2 -- the number is in hours ]]--
function onSay(cid, words, param)
    local parametres = string.explode(param, ",")
    if(parametres[1] ~= "") then
        local acc = getAccountIdByName(parametres[1])
        if(acc > 0) then
            if(parametres[2] ~= "" and tonumber(parametres[2]) > 0) then
                time = tonumber(parametres[2])
            end
            local player = getPlayerByName(parametres[1])
            if(isPlayer(player) == true) then
				doAddBanishment(acc, time)
                doRemoveCreature(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