Postado Novembro 6, 2016 8 anos Tenho um script mas ta dando error, tfs 1.2 alguem fixar? ou possui um pra passar? random_items = { {5,2112,1}, -- 0.5% to get teddy bear {20,6512,1}, -- 2% to get santa doll {40,2114,1}, -- 4% to get piggy bank {80,2111,5}, -- 8% to get 5 snowballs {80,2688,8}, -- 8% to get 8 candy canes {80,2110,1}, -- 8% to get doll {400,2674,15}, -- 40% to get 15 red apples {450,2675,10}, -- 45% to get 10 oranges {1000,2687,8} -- 100% to get 8 cookies } PRESENT_STORAGE = 54163 -- storage ID local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "present") and npcHandler.topic[cid] == 0 then if player:getStorageValue(PRESENT_STORAGE) == 1 then npcHandler:say('I gave you a present already.', cid) return false else npcHandler:say("Were you good this year?", cid) npcHandler.topic[cid] = 1 end elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then local item = {} local reward = 0 local count = "" for i = 1, #random_items do item = random_items[i] if (math.random(0,999) < item[1]) then reward = item[2] subType = item[3] if subType > 1 then count = subType .. " " end break end end player:addItem(reward, subType) player:setStorageValue(PRESENT_STORAGE, 1) elseif msgcontains(msg, "no") then npcHandler:say('Come back when you start behaving good.', cid) else npcHandler:say("What? I can't hear you.") end return true end npcHandler:setMessage(MESSAGE_GREET, "Merry Christmas |PLAYERNAME|. I'm Santa Claus. I got {presents} for good children.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Novembro 6, 2016 8 anos Em 06/11/2016 em 00:30, Dolera disse: Tenho um script mas ta dando error, tfs 1.2 alguem fixar? ou possui um pra passar? random_items = { {5,2112,1}, -- 0.5% to get teddy bear {20,6512,1}, -- 2% to get santa doll {40,2114,1}, -- 4% to get piggy bank {80,2111,5}, -- 8% to get 5 snowballs {80,2688,8}, -- 8% to get 8 candy canes {80,2110,1}, -- 8% to get doll {400,2674,15}, -- 40% to get 15 red apples {450,2675,10}, -- 45% to get 10 oranges {1000,2687,8} -- 100% to get 8 cookies } PRESENT_STORAGE = 54163 -- storage ID local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, "present") and npcHandler.topic[cid] == 0 then if player:getStorageValue(PRESENT_STORAGE) == 1 then npcHandler:say('I gave you a present already.', cid) return false else npcHandler:say("Were you good this year?", cid) npcHandler.topic[cid] = 1 end elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then local item = {} local reward = 0 local count = "" for i = 1, #random_items do item = random_items[i] if (math.random(0,999) < item[1]) then reward = item[2] subType = item[3] if subType > 1 then count = subType .. " " end break end end player:addItem(reward, subType) player:setStorageValue(PRESENT_STORAGE, 1) elseif msgcontains(msg, "no") then npcHandler:say('Come back when you start behaving good.', cid) else npcHandler:say("What? I can't hear you.") end return true end npcHandler:setMessage(MESSAGE_GREET, "Merry Christmas |PLAYERNAME|. I'm Santa Claus. I got {presents} for good children.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Meu amor se você não postar o erro não tem como adivinhar *_* @This life is filled with hurt When happiness doesn't work Trust me and take my hand When the lights go out you will understand
Postado Novembro 6, 2016 8 anos Autor Em 06/11/2016 em 01:07, login12 disse: Se eu escrever qualquer coisa como exemplo "aoskdoajh" da esse erro: http://prntscr.com/d3lrtl
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.