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

Promotion to player - God Talkaction

date

New Member
Joined
Jun 17, 2016
Messages
13
Reaction score
1
Does someone knows or can help me with a script that allows the God or the Community Manager to give promotion to players?

Something like:

/promotion Nick

And that player becomes either master sorcerer, elder druid, royal paladin or elite knight.

I'm using TFS 0.4

Thanks!
 
god this took forever inbetween calls at work. T.T

put in talkactions /promote

use like..
-- 0 = remove promotion
/promote Xikini, 1
Xikini's promotional status has been altered. Xikini's vocation is now set to | OtLand Community Helper.

Untested.
Code:
local max_promotion_level = 1

function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
        return true
    end

    local t = string.explode(param, ",")
    if(not t[2]) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough params.")
        return true
    end

    local pid = getPlayerByNameWildcard(t[1])
    if not pid or isPlayerGhost(pid) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
        return true
    end

    if not tonumber(t[2]) ~= nil then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Promotion param not a number.")
        return true
    end

    local promo_level = tonumber(t[2])

    if promo_level < 0 or promo_level > max_promotion_level then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Promotion param is not acceptable. Number must be above -1 and below " .. max_promotion_level ..".")
        return true
    end

    if getPlayerPromotionLevel(pid) ~= promo_level then
        doPlayerSetPromotionLevel(pid, promo_level)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "" .. t[1] .. "'s promotional status has been altered. " .. t[1] .. "'s vocation is now set to | " .. getPlayerVocationName(pid) .. ".")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is already set to this promotional level.")
    end

    return true
end
 
Last edited:
Thanks Xikini.
I tested it but when I write in this case

I want to promote a player from sorcerer to master
I do this.
/promotion Player, 1

Error:
Promotion param not a number.

Then I do this:
/promotion Player, 5

Error:
Promotion param not a number.
 
Thanks Xikini.
I tested it but when I write in this case

I want to promote a player from sorcerer to master
I do this.
/promotion Player, 1

Error:
Promotion param not a number.

Then I do this:
/promotion Player, 5

Error:
Promotion param not a number.
Sorry that was my derp.
Code:
local max_promotion_level = 1

function onSay(cid, words, param, channel)
     if(param == '') then
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
         return true
     end
    
     local t = string.explode(param, ",")
     if(not t[2]) then
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough params.")
         return true
     end
    
     local pid = getPlayerByNameWildcard(t[1])
     if not pid or isPlayerGhost(pid) then
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
         return true
     end
    
     local promo_level = tonumber(t[2])
     if promo_level == nil then
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Promotion param not a number.")
         return true
     end
    
     if promo_level < 0 or promo_level > max_promotion_level then
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Promotion param is not acceptable. Number must be above -1 and below " .. max_promotion_level ..".")
         return true
     end
    
     if getPlayerPromotionLevel(pid) ~= promo_level then
         doPlayerSetPromotionLevel(pid, promo_level)
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "" .. t[1] .. "'s promotional status has been altered. " .. t[1] .. "'s vocation is now set to | " .. getPlayerVocationName(pid) .. ".")
     else
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player is already set to this promotional level.")
     end
    
     return true
end

-- Edit

If you get a chance, can you advise if the script is working as intended?
 
Last edited:
Hi Xikini! Sorry for not answering before.

The script is working great!!

Thanks for taking time from your job to help people like me.
 
Back
Top