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()