SixNine
Active Member
- Joined
- Dec 12, 2018
- Messages
- 452
- Reaction score
- 41
Hi,
so i made this ugly code but i cant figure out how to change broadcast type to one that send in the middle of screen since now its sends in default chat only i was looking into /b talkaction so i though maybe it just not possible i dont know. This is my code TFS 1.2
so i made this ugly code but i cant figure out how to change broadcast type to one that send in the middle of screen since now its sends in default chat only i was looking into /b talkaction so i though maybe it just not possible i dont know. This is my code TFS 1.2
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local messages = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if not isPremium(cid) then
npcHandler:say("You dont have premium!", cid)
elseif(msgcontains(msg, 'broadcast') or msgcontains(msg, 'b') or msgcontains(msg, 'cast') or msgcontains(msg, 'broadcastt') and talkState[talkUser] == 0) then
npcHandler:say("Do you want to broadcast '".. msg .."' for 100 gold?", cid)
messages[cid] = msg
talkState[talkUser] = 1
elseif (msg == "yes" and talkState[talkUser] == 1) then
if getPlayerItemCount(cid, 2160) >= 100 then
broadcastMessage(getCreatureName(cid) ..": ".. messages[cid])
doPlayerRemoveItem(cid, 2160, 100)
else
npcHandler:say("You don't have enough money.", cid)
end
messages[cid] = nil
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())/code]