local config = {
maxGroup = 6,
groupName = {
[1] = "player", [2] = "tutor", [3] = "senior tutor",
[4] = "gamemaster", [5] = "community manager", [6] = "god" }
}
function onSay(cid, words, param)
if param ~= nil then
local target = getPlayerByNameWildcard(param)
if target ~= FALSE then
if words == "/promote" then
if getPlayerGroupId(target) < config.maxGroup then
setPlayerGroupId(target, getPlayerGroupId(target) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have promoted "..target.." to "..config.groupName[getPlayerGroupId(target)]..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, "You have been promoted to "..config.groupName[getPlayerGroupId(target)]..".")
local account = getPlayerAccountId(target)
db.executeQuery("UPDATE accounts SET type = type + 1 WHERE id = "..account..";")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player is already a "..config.groupName[config.maxGroup]..".")
end
elseif words == "/demote" then
setPlayerGroupId(target, getPlayerGroupId(target) - 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have demoted "..target.." to "..config.groupName[getPlayerGroupId(target)]..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, "You have been demoted to "..config.groupName[getPlayerGroupId(target)]..".")
local account = getPlayerAccountId(target)
db.executeQuery("UPDATE accounts SET type = type - 1 WHERE name = "..account..";")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A player with that name does not exist.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to specify players name.")
end
return FALSE
end