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

Can anyone fix this talkaction?

baller23

New Member
Joined
Jan 28, 2009
Messages
4
Reaction score
0
---Made By Huggen---
--Credits To All Who Helped Me Learn Lua-->

--Config--

local cash = 1 -- Money needed to Braodcast
local levelneeded = 50 -- Level needed to broadcast
local lenght = 50 -- Max lenght of msg
local messagesort = MESSAGE_STATUS_WARNING -- can be "MESSAGE_STATUS_WARNING" or "TALKTYPE_ORANGE_1" check your global.lua for more...

--End of config--

function onSay(cid, words, param)
if isExhausted(cid) == 1 then
return 0
end

local name = getPlayerName(cid)
local level = getPlayerLevel(cid)

if isCreature(cid) == 1 then
if param ~= nil then
if string.len(param) < lenght then
if level >= levelneeded then
if doPlayerRemoveMoney(cid, 7910, 1)) == TRUE then
broadcastMessage( ''..name..' ['..level..'] says: ' .. param .. '', messagesort)
else
doPlayerSendCancel(cid, 'You need '..cash..' epic peanut to broadcast! YOU TO POOR!')
end
else
doPlayerSendCancel(cid, 'You need to be level '..levelneeded..' to broadcast! YOU TO NOOBY!')
end
else
doPlayerSendCancel(cid, 'No more than ' .. lenght .. ' character. ')
end
else
doPlayerSendCancel(cid, 'You must enter a text')
end
else
doPlayerSendCancel(cid, 'You haven\'t a target!')
end
return setExhausted(cid)
end

I'm getting the error :data/talkactions/scripts/broadcast1.lua:25: 'then' expected near ')'

so can any one fix this and send me it in private?
thanks~~
 
Lua:
---Made By Huggen---
--Credits To All Who Helped Me Learn Lua-->

--Config--

local cash = 1 -- Money needed to Braodcast
local levelneeded = 50 -- Level needed to broadcast
local lenght = 50 -- Max lenght of msg
local messagesort = MESSAGE_STATUS_WARNING -- can be "MESSAGE_STATUS_WARNING" or "TALKTYPE_ORANGE_1" check your global.lua for more...

--End of config--

function onSay(cid, words, param)
if isExhausted(cid) == 1 then
return 0
end

local name = getPlayerName(cid)
local level = getPlayerLevel(cid)

if isCreature(cid) == 1 then
if param ~= nil then
if string.len(param) < lenght then
if level >= levelneeded then
if doPlayerRemoveMoney(cid, 7910, 1) == TRUE then
broadcastMessage( ''..name..' ['..level..'] says: ' .. param .. '', messagesort)
else
doPlayerSendCancel(cid, 'You need '..cash..' epic peanut to broadcast! YOU TO POOR!')
end
else
doPlayerSendCancel(cid, 'You need to be level '..levelneeded..' to broadcast! YOU TO NOOBY!')
end
else
doPlayerSendCancel(cid, 'No more than ' .. lenght .. ' character. ')
end
else
doPlayerSendCancel(cid, 'You must enter a text')
end
else
doPlayerSendCancel(cid, 'You haven\'t a target!')
end
return setExhausted(cid)
end

also, next time try posting in the support board
 
wrong section(support is here for purpose)
and us ecode not quote, less space wasted and tabbing wont be lost
(without tabbing I don't even bother to read the code, probably many other people too)

@up: hey Panda, ur 2 fast
 
uhm now i got a error saying data/talkactions/scripts/broadcast1.lua:14: attempt to call global 'isExhausted' (a nil value)
and my bad for posting in wrong section >.<
 
Here is the one i use if you want :)


PHP:
  --- 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 = 60 -- Seconds.
--- End config ---

function onSay(cid, words, param)
local broadcastPrice = 100000
    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: 10cc")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Broadcast successfully sent. (-10cc)")
        broadcastMessage(getPlayerName(cid) .. " [" .. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_EVENT_ADVANCE)
        setPlayerStorageValue(cid, storageValue, 1)
        exhaustion.set(cid,storageValue,exhaustTime)
		return true
    end
return true
end
 
Back
Top