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

Solved Player Broadcast system 0.3.6 TFS

Forsaken13126

Scripter
Joined
Feb 4, 2010
Messages
224
Reaction score
3
Location
New York
I was trying to create a broadcast script for players(i also want to add in so you need first prestige to use it later) and when i was just trying to test it, it says it loads correctly no errors then i type it in game and it does nothing... still no error in server log i want a 5 minute exhaust so people cannot spam.... If anyone could help me fix this script or if they have another working one it would be greatly appreciated thanks alot :D

(Works for staff but not regular players)

my talkaction script V

Code:
<talkaction words="/broadcast" script="playerbroadcast.lua"/>

My playerbroadcast.lua V

Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 300000) -- time in seconds x1000



function onSay(cid, words, param, channel)
    if(param == '') then
        return true
    end

    doPlayerBroadcastMessage(cid, param)
    return true
end
 
Try this.

Code:
function onSay(cid, words, param, channel)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 300000) -- time in seconds x1000

if(param == '') then
return true
end

doPlayerBroadcastMessage(cid, param)
return true
end
 
Try this.

Code:
function onSay(cid, words, param, channel)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 300000) -- time in seconds x1000

if(param == '') then
return true
end

doPlayerBroadcastMessage(cid, param)
return true
end

Got this error

[30/12/2013 22:47:03] [Error - TalkAction Interface]
[30/12/2013 22:47:03] data/talkactions/scripts/playerbroadcast.lua:eek:nSay
[30/12/2013 22:47:03] Description:
[30/12/2013 22:47:03] (luaSetConditionParam) This function can only be used while loading the script.
 
Last edited:
Oh? That's weird...
I don't know how to fix it.
You really need to put it in the beginning.

----------------------
Oh wait.
I did it :p
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 300000)

function onSay(cid, words, param, channel)
    if getCreatureCondition(cid, CONDITION_EXHAUST) == TRUE then
    return doPlayerSendCancel(cid, 'You need to wait 5 minutes before broadcasting again.')
    end
    if(param == '') then
        return true
    end
    if doPlayerBroadcastMessage(cid, param) then
    doAddCondition(cid, exhaust)
    return true
    end
    return true
end
 
The original script works?
(
Code:
function onSay(cid, words, param, channel)
if(param == '') then
return true
end

doPlayerBroadcastMessage(cid, param)
return true
end
)
 
They (both scripts playerbroadcast and the original broadcast script) work for Staff, but not for regular players and i tried adding broadcast flags to players but it seems as if it didnt work
 
That's really weird... My script worked here.
Look.. I have this script, that doesn't use addCondition...
Try it.

Code:
  --- Config ---
local levelReq = 200 -- Level needed to use the command.
local minChars = 3 -- How many characters may you write as minumum?
local group_id = 5 -- Group to not use the script.

--- Exhaust Settings ---
local useExhaust = TRUE -- FALSE = Broadcast as fast as they want.
local storageValue = 12388 -- Storage for Exhaust to work.
local exhaustTime = 300 -- Seconds.
--- End config ---

function onSay(cid, words, param)
local broadcastPrice = 0
    if getPlayerLevel(cid) < levelReq then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Sorry, you need to be at least level " .. levelReq .. " to use this command.")
    return true
    end
    if (useExhaust == TRUE) and exhaustion.check(cid,storageValue) == true then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to wait "..exhaustion.get(cid,storageValue).." seconds before broadcasting another message.")
    return true
    end
    if string.len(param) < minChars then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you need to enter at least " .. minChars .. " characters.")
    return true
    end
    if getPlayerGroupId(cid) > group_id then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, staff members do not need to broadcast messages with this command.")
    return true
    end
    if doPlayerRemoveMoney(cid, broadcastPrice) == FALSE then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you do not have enough money. Cost: 5,000,000 gold coins")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Broadcast successfully sent. (-5,000,000 gold coins)")
        broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_EVENT_ADVANCE)
        setPlayerStorageValue(cid, storageValue, 1)
        exhaustion.set(cid,storageValue,exhaustTime)
        return true
    end
return true
end
(Credits to Elf, I think)

Flag:
Code:
    <talkaction words="!broadcast" event="script" value="playerbroadcast.lua"/>
 
Back
Top