Postado Junho 23, 2015 9 anos Bom dia. Galera eu queria saber se tem alguém com um NPC que troca de sexo dos player que poderia ta me passando esse NPC. E se não for pedir muito eu gostaria que o NPC cobrasse P.A pro player pela troca de sexo Se alguém poder me ajuda +REP 8.60 0.4 Deis de ja muito obrigado pela a tenção de você galera TK *-* Editado Junho 23, 2015 9 anos por jhubber (veja o histórico de edições)
Postado Junho 23, 2015 9 anos 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 price = xxx --Preço para trocar de sexo. if msgcontains(msg:lower(), "change") or msgcontains(msg:lower(), "sex") then selfSay("Do you wanna change your sex? It will cost {"..price.." gold}.", cid) talkState[talkUser] = 1 return true elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, price) then doPlayerSetSex(cid, getPlayerSex(cid) == 0 and 1 or 0) selfSay("You sucefully changed your sex.", cid) talkState[talkUser] = 0 return true else selfSay("You do not have enough gold.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, bye.", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Script: zipter98
Postado Junho 23, 2015 9 anos Solução acabei de fazer um aqui pq nem tinha arquivo.xml <npc name="sex" script="data/npc/scripts/sex.lua" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="128" head="0" body="87" legs="39" feet="0"/> <parameters> <parameter key="module_travel" value="1"/> <parameter key="message_greet" value="Olá |PLAYERNAME|. quer troca de sexo virar um traveco diga {sex change} ?" /> </parameters> </npc> sex.lua local item_id = {2160,1} -- edita aqui 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) local msg = msg:lower(); local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "sex change") then if doPlayerRemoveItem(cid,item_id[1],item_id[2]) then doPlayerSetSex(cid,getPlayerSex(cid) == 1 and 0 or 1) doPlayerSendTextMessage(cid,22,"pronto troquei o seu sexo") doSendMagicEffect(getCreaturePosition(cid),28) else selfSay("você não tem dinheiro", cid) talkState[talkUser] = 0 end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Junho 23, 2015 9 anos Autor 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 price = xxx --Preço para trocar de sexo. if msgcontains(msg:lower(), "change") or msgcontains(msg:lower(), "sex") then selfSay("Do you wanna change your sex? It will cost {"..price.." gold}.", cid) talkState[talkUser] = 1 return true elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, price) then doPlayerSetSex(cid, getPlayerSex(cid) == 0 and 1 or 0) selfSay("You sucefully changed your sex.", cid) talkState[talkUser] = 0 return true else selfSay("You do not have enough gold.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("Ok, bye.", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Script: zipter98 Da erro ao importa para o mapa
Postado Junho 23, 2015 9 anos Da erro ao importa para o mapa é o xml então que está errado... Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado). Tópicos: [FAQ] BBCODE [LIB] Constant [RME] Administrando bordas. [TALK] Broadcast Editável. [TALK] Sugest. [TALK] Checkpoint. [MOVE] Pântano pegajoso. [ACTION] Piggy Bank. (Cassino). [GLOBAL] Uptime Ad. [C0DE] Consertando 'Invalid Password' [PROGRAM] Quest Maker
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.