Postado Janeiro 10, 2018 7 anos Hello! Can someone help me with an npc that you have to pay "X" amount of money to give you permission to be able to perform the BlackSmith.I would not know if blocking the use of the hammer id = "xxxx" would be an option or as, but if someone can help me I would greatly appreciate it, likewise thank you in advance.
Postado Janeiro 11, 2018 7 anos @costantino2, We are going to use a storage ID to identify if the player has permission or not. Try something like that: Add this tag in the beginning of your blacksmith system .lua: local config = { storageID = 10000, errorMsg = "You dont have permission to use this." } And this other in the beginning of function onUse (.lua): if getPlayerStorageValue (cid, config.storageID) ~= 1 then doPlayerSendTextMessage(cid,22, config.errorMsg) return true end NPC Script, try something like this one: 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 config = { storageID = 10000, price = 10000, } 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 msgcontains(msg, 'blacksmith') then selfSay('Do you want to have permission to blacksmithing?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveMoney(cid, config.price)) then setPlayerStorageValue(cid, config.storageID, 1) selfSay('Here you are.', cid) else selfSay('Sorry, you don\'t have enough gold.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then talkState[talkUser] = 0 selfSay('Ok then.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Janeiro 11, 2018 7 anos por marcot (veja o histórico de edições)
Postado Janeiro 11, 2018 7 anos Autor 23 minutos atrás, marcot disse: @costantino2, We are going to use a storage ID to identify if the player has permission or not. Try something like that: Add this tag in the beginning of your blacksmith system .lua: local config = { storageID = 10000, errorMsg = "You dont have permission to use this." } And this other in the beginning of function onUse (.lua): if getPlayerStorageValue (cid, config.storageID) ~= 1 then doPlayerSendTextMessage(cid,22, config.errorMsg) return true end NPC Script, try something like this one: 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 config = { storageID = 10000, price = 10000, } 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 msgcontains(msg, 'blacksmith') then selfSay('Do you want to have permission to blacksmithing?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveMoney(cid, config.price)) then setPlayerStorageValue(cid, config.storageID, 1) selfSay('Here you are.', cid) else selfSay('Sorry, you don\'t have enough gold.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then talkState[talkUser] = 0 selfSay('Ok then.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Eu escrevi uma mensagem para ele não fazer tanto spam, obrigado antecipadamente e desculpe pelo inconveniente Oi! Desculpe-me? O storage deve adicioná-lo à actions, criatureScript ou lib? É um sistema personalizado eo programador que o projetou não deixa explicações muito claras da parte técnica. 23 minutos atrás, marcot disse:
Postado Janeiro 11, 2018 7 anos The first and second add them to hammer's script (action). The third one is a NPC script. I can explain better tomorrow when i wake up, im in my cellphone :s
Postado Janeiro 11, 2018 7 anos Autor 3 minutos atrás, marcot disse: The first and second add them to hammer's script (action). The third one is a NPC script. I can explain better tomorrow when i wake up, im in my cellphone :s A coisa é que o martelo não possui nenhum script nas actions, tudo é direto. Ok, você tem discórdia para uma melhor comunicação? xd Vou enviar minha discórdia em privado apenas no caso. muito obrigado antecipadamente e boa noite
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.