Postado Maio 9, 2015 10 anos yes [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Maio 9, 2015 10 anos Autor Yes o que? Por ter dado certo? Só falta o player poder comprar apenas um ticket, ao invés dos dois.
Postado Maio 9, 2015 10 anos Solução n tinha pensado nisso, vlw. já editei de novo @ -- editei de novo pq tinha faltando um "and" usa o que eu editei lá agr que é esse: 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg, price = string.lower(msg), 200000 local team = {["blue"] = {storage = 34789}, ["green"] = {storage = 34790}} if isInArray({'bilhete', 'ticket', 'tickets'}, msg) then npcHandler:say('Você quer participar de que time por '..price..'? se sim escolha um time: {blue} ou {green}', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if team[msg] then if getGlobalStorageValue(34789) < 20 and getGlobalStorageValue(34790) < 20 then if getPlayerStorageValue(cid, 34789) <= 0 and getPlayerStorageValue(cid, 34790) <= 0 then if doPlayerRemoveMoney(cid, price) then setPlayerStorageValue(cid, team[msg].storage, 1) setGlobalStorageValue(team[msg].storage,getGlobalStorageValue(team[msg].storage) < 0 and 1 or getGlobalStorageValue(team[msg].storage)+1) npcHandler:say('aqui está seu bilhete.', cid) else npcHandler:say('you do not have enough money!', cid) talkState[talkUser] = 0 end else npcHandler:say('you already have ticket!', cid) talkState[talkUser] = 0 end else npcHandler:say('ticket esgotado!', cid) talkState[talkUser] = 0 end end elseif msg == "no" then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Maio 9, 2015 10 anos por Vodkart (veja o histórico de edições) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Maio 9, 2015 10 anos Autor Funcionou, valeu! Teria como quando player comprasse o ticket a outfit dele mudasse de cor? e ele só pudesse tirar a cor da outfit quando perder a storage? Editado Maio 9, 2015 10 anos por arthur122222 (veja o histórico de edições)
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.