• 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 notation + ban tfs 1.5 talkaction

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
128
Location
Brazil
YouTube
caruniawikibr
hello guys, does anyone have a talkaction script where the person receives the notification from the gm, and if he is notified twice more, he is banned?
 
Try this
Lua:
local storageForNotations = PlayerStorageKeys.notations
local reason = "Ban reason here"
local banDays = 1

local notation = TalkAction("/notate")

function notation.onSay(player, words, param)
    local name = param
    local playerToNotate = Player(name)
    local timeNow = os.time()
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end
    if playerToNotate:getStorageValue(storageForNotations) >= 2 then
        playerToNotate:setStorageValue(storageForNotations, 0)
        db.query(
            "INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" ..
                getAccountNumberByPlayerName((name)) ..
                    ", " .. db.escapeString(reason) .. ", " .. timeNow .. ", " .. timeNow + (banDays * 86400) .. ", 1)"
        )
        playerToNotate:remove()
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, name .. " has been banned.")
    else
        playerToNotate:setStorageValue(storageForNotations, (playerToNotate:getStorageValue(storageForNotations)) + 1)
        playerToNotate:sendTextMessage(
            TALKTYPE_MONSTER_SAY,
            "You have " .. playerToNotate:getStorageValue(storageForNotations) .. " notations."
        )
        player:sendTextMessage(
            MESSAGE_EVENT_ADVANCE,
            "You have notated " ..
                name .. " he has now " .. playerToNotate:getStorageValue(storageForNotations) .. " notations."
        )
    end
    return false
end

notation:separator(" ")
notation:register()
You have to change this storage PlayerStorageKeys.notations, Either add a number or add it as my example in data/lib/core/storages.lua
 
Last edited:
Try this
Lua:
local storageForNotations = PlayerStorageKeys.notations
local reason = "Ban reason here"
local banDays = 1

local notation = TalkAction("/notate")

function notation.onSay(player, words, param)
    local name = param
    local playerToNotate = Player(name)
    local timeNow = os.time()
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end
    if playerToNotate:getStorageValue(storageForNotations) >= 2 then
        playerToNotate:setStorageValue(storageForNotations, 0)
        db.query(
            "INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" ..
                getAccountNumberByPlayerName((name)) ..
                    ", " .. db.escapeString(reason) .. ", " .. timeNow .. ", " .. timeNow + (banDays * 86400) .. ", 1)"
        )
        playerToNotate:remove()
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, name .. " has been banned.")
    else
        playerToNotate:setStorageValue(storageForNotations, (playerToNotate:getStorageValue(storageForNotations)) + 1)
        playerToNotate:sendTextMessage(
            TALKTYPE_MONSTER_SAY,
            "You have " .. playerToNotate:getStorageValue(storageForNotations) .. " notations."
        )
        player:sendTextMessage(
            MESSAGE_EVENT_ADVANCE,
            "You have notated " ..
                name .. " he has now " .. playerToNotate:getStorageValue(storageForNotations) .. " notations."
        )
    end
    return false
end

notation:separator(" ")
notation:register()
You have to change this storage PlayerStorageKeys.notations, Either add a number or add it as my example in data/lib/core/storages.lua
how it should be aded inside data/lib/core/storages.lua ?
 
Script should be added in data/scripts/talkactions, I was talking about the storage that could be added in here.
 
Script should be added in data/scripts/talkactions, I was talking about the storage that could be added in here.
this is wjhat i did not get You have to change this storage PlayerStorageKeys.notations, Either add a number or add it as my example in data/lib/core/storages.lua
 
Back
Top