Postado Janeiro 26, 2017 8 anos Bom dia ,boa tarde e boa noite vim aki pedir um systema resert level que quando ele reserta ganha um item especifico Como Poke Coins Alguem Poderia me passar pfv Rep+ !
Postado Janeiro 26, 2017 8 anos Autor NPC Amigo , Eu reserto o level nele e quando eu resertar eu ganho (x) item toda vez que eu resertar ! NPC Amigo , Eu reserto o level nele e quando eu resertar eu ganho (x) item toda vez que eu resertar !
Postado Janeiro 26, 2017 8 anos crie um arquivo chamado reseter.lua na pasta data\npc\scripts\ e coloque isso daqui dentro dele: --[[Script made 100% by Nogard,Night Wolf and Wend. You can feel free to edit anything you want, but don't remove the credits]] local config = { minlevel = 1, --- level inical para resetar newlevel = 8, --- level após reset maxresets = 50, levelbyreset = 0 --- quanto de level vai precisar a mais no próximo reset } function getResets(uid) resets = getPlayerStorageValue(uid, 378378) if resets < 0 then resets = 0 end return resets end 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 function addReset(cid) if(npcHandler:isFocused(cid)) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 resets = getResets(cid) setPlayerStorageValue(cid, 378378, resets+1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerAddItem(cid, 2394, 10) -- ID do item e quantidade doRemoveCreature(cid) local description = resets+1 db.executeQuery("UPDATE `players` SET `description` = ' [Reset: "..description.."]' WHERE `players`.`id`= ".. playerid .."") db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") return true end local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset) if msgcontains(msg, 'reset') then if getResets(cid) < config.maxresets then selfSay('Voce quer resetar seu level?', cid) talkState[talkUser] = 1 else selfSay('You already reached the maximum reset level!', cid) end elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerLevel(cid) < newminlevel then selfSay('The minimum level for reseting is '..newminlevel..'!', cid) else playerid = getPlayerGUID(cid) addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid)+1 local msg ="---[Reset: "..number.."]-- You have reseted! You'll be disconnected in 3 seconds." doPlayerPopupFYI(cid, msg) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) selfSay('Ok.', cid) elseif msgcontains(msg, 'quantity') then selfSay('You have a total of '..getResets(cid)..' reset(s).', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Feito isso, crie agora o npc que irá utilizar esse script.. em data\npc crie um arquivo.xml chamado Reseter.xml e coloque isso dentro dele: <npc name="Reseter" script="data/npc/scripts/reseter.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="510" head="91" body="114" legs="86" feet="0"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|.I've been waiting for you to come.. Say 'reset' or 'quantity'" /> <parameter key="message_farewell" value="Cya folk." /> <parameter key="message_walkaway" value="How Rude!" /> </parameters> </npc> Agora é só colocar o seu npc no mapa pelo rme e testar
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.