• 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 Commands for gm

fironfox

New Member
Joined
Dec 14, 2012
Messages
42
Reaction score
1
I need to make a GM able to /addtutor /removetutor but i cant make this, only administrator can use this comands and i dont know how to change this and where... Can someone help me?

Code:
function onSay(cid, words, param)
    local player = Player(cid)
    if player:getAccountType() <= ACCOUNT_TYPE_TUTOR then
        return true
    end

    local target = Player(param)
    if target == nil then
        player:sendCancelMessage("A player with that name is not online.")
        return false
    end

    if target:getAccountType() ~= ACCOUNT_TYPE_NORMAL then
        player:sendCancelMessage("You can only promote a normal player to a tutor.")
        return false
    end

    target:setAccountType(ACCOUNT_TYPE_TUTOR)
    target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been promoted to a tutor by " .. player:getName() .. ".")
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have promoted " .. target:getName() .. " to a tutor.")
    return false
end
 
https://github.com/otland/forgotten...984d4b997f82d10769f205c/src/enums.h#L123-L127

so:
Code:
function onSay(cid, words, param)
    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
        return false
    end

    local target = Player(param)
    if target == nil then
        player:sendCancelMessage("A player with that name is not online.")
        return false
    end

    if target:getAccountType() ~= ACCOUNT_TYPE_NORMAL then
        player:sendCancelMessage("You can only promote a normal player to a tutor.")
        return false
    end

    target:setAccountType(ACCOUNT_TYPE_TUTOR)
    target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been promoted to a tutor by " .. player:getName() .. ".")
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have promoted " .. target:getName() .. " to a tutor.")
    return false
end

This should now only be usable by GM's and Gods.
 
https://github.com/otland/forgotten...984d4b997f82d10769f205c/src/enums.h#L123-L127

so:
Code:
function onSay(cid, words, param)
    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
        return false
    end

    local target = Player(param)
    if target == nil then
        player:sendCancelMessage("A player with that name is not online.")
        return false
    end

    if target:getAccountType() ~= ACCOUNT_TYPE_NORMAL then
        player:sendCancelMessage("You can only promote a normal player to a tutor.")
        return false
    end

    target:setAccountType(ACCOUNT_TYPE_TUTOR)
    target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been promoted to a tutor by " .. player:getName() .. ".")
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have promoted " .. target:getName() .. " to a tutor.")
    return false
end

This should now only be usable by GM's and Gods.


Don't worked here :/ No have any error in tfs but dont work if are in GM
 
Back
Top