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

Fixing command /ban, help plz

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
Hello, I have this script for talkactions

Lua:
‎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
            doAddBanishment(accId, lenght * 3600 * 24, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
            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

It works well, but when you ban someone it doesnt add a warning +1, could someone fix this and add this param plx?

Repping who helps!
Thanks.
 
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
                comment = parametres[3]
            end
            doAddBanishment(accId, lenght * 3600 * 24, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
            doAddBanishment(accId, -1, 23, ACTION_NOTATION, comment, getPlayerGUID(cid), comment)
            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
 
Lua:
‎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
            doAddBanishment(accId, lenght * 3600 * 24, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
            local player = getPlayerByNameWildcard(parametres[1])
            if(isPlayer(player) == TRUE) then
                doPlayerSendTextMessage(player, 1, "You are banished")
                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

I hope this is what you mean.
 
It isnt working... There is a table called account, where is a column called warning, that is the level of banns... Any time you get banned it increases by 1.

So if you use this command with this script, it will ban, but it doesnt add warning to the player.

Could you make that this script increase the warning level by one any time you bann someone?
 
Try this:

On talkactions.xml add:

PHP:
<talkaction log="yes" words="/ban" access="4" event="script" value="ban.lua"/>

now on scripts make a script called ban and add inside:


Lua:
local default_comment = ""
local default_lenght = 1 -- 1 = 1 hour, 2 = 2 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
            doAddBanishment(accId, lenght * 3600, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
            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 a name.")
    end
    return true
end

To ban the player:

/ban Name, Time, Comment
or
/ban Time, Name, Comment
 
hahaha no one can do this script xD
it is so hard to add on a ban script a function that increase the warning of player at the account?
 
Back
Top