• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Broadcast for Premium Players

mpa

Member
Joined
Oct 8, 2008
Messages
319
Reaction score
13
Location
Sweden
If a player has premium account, he can broadcast every five minutes.
Credit to Keraxel for helping me with exhaust :thumbup:

PHP:
-- by mpa 2009-02-07

function onSay(cid, words, param)
    local exhaustTime = 5 * 60
    local message = "" .. getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param .. ""
    
        if exhaustion.check(cid, 8860) == TRUE then
                doPlayerSendCancel(cid, "Sorry, you may only broadcast once every 5 minutes.")
            return TRUE
        end
        
        if isPremium(cid) == TRUE then
            if (exhaustion.make(cid, 8860, exhaustTime)) == TRUE then                    
                    doBroadcastMessage(cid, "" ..message.. "", MESSAGE_EVENT_ADVANCE)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Broadcast sent.")
                else
                doPlayerSendCancel(cid, "Sorry, you may only broadcast once every 5 minutes.")
            end
        end
    return TRUE
end
 
Code:
if exhaustion.check(cid, 8860) == TRUE then
                doPlayerSendCancel(cid, "Sorry, you may only broadcast once every 5 minutes.")
            return TRUE
        end
It's unnessesary, if exhaustion.make returns FALSE the message will be sent.
 
Last edited:
Code:
if exhaustion.check(cid, 8860) == TRUE then
                doPlayerSendCancel(cid, "Sorry, you may only broadcast once every 5 minutes.")
            return TRUE
        end
It's unnessesary, if exhaustion.make returns FALSE the message will be sent.

No you can still broadcast. But when I added this everything worked as it should.
 
O.0 That's weird :/

PHP:
-- by mpa 2009-02-07

function onSay(cid, words, param)
    local storage = 8860
    local exhaustTime = 5 * 60 -- 5 minutes
    local message = getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param
    
	if exhaustion.check(cid, storage) == TRUE then
		doPlayerSendCancel(cid, "Sorry, you may only broadcast once every ".. math.ceil(exhaustTime / 60) .." minutes.")
		return TRUE
	end
	if isPremium(cid) ~= TRUE then
		doPlayerSendCancel(cid, "Sorry, you haven't premium account.")
	end

	exhaustion.set(cid, storage, exhaustTime)                   
	doBroadcastMessage(cid, message, MESSAGE_EVENT_ADVANCE)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Broadcast sent.")
return TRUE
end
Fixed a bit ;)
 
Last edited:
Back
Top