Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
local count = 5
local chanse = math.random(1, 6)
player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
---------------------------------------------------------------------------
if msgcontains(msg, 'play') or msgcontains(msg, 'roll') then
selfSay('How much do you want to play?.')
talk_state = 1
end
------------------------------------------------ confirm yes ------------------------------------------------
if param ~= "" and talk_state == 1 then
SelfSay('Do you want to bet ' ..param.. ' to win ' ..param.. '*count?')
end
talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if chanse < 6 then
doPlayerAddMoney(cid, param * count)
end
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Code:
Something about an 'end' close to the function at line 31~~
Could anyone fix it?(A)