Postado Março 26, 2015 10 anos Boa Noite... Eu utilizo esse script para vip function onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) local viptimestorage = 15001 local itemid = 11754 local vipdays = 10 local left = os.date("%d", player:getStorageValue(viptimestorage) - os.time()) if player:getItemCount(itemid) == 0 then player:sendTextMessage(MESSAGE_STATUS_WARNING, "You don't have an item.") elseif player:getStorageValue(viptimestorage) >= os.time() then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You still have " .. left .. " VIP Days.") else player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You got VIP " .. vipdays .. " days.") player:setStorageValue(viptimestorage, os.time() + vipdays * 60 * 60 * 24) doRemoveItem(item.uid, 1) end return true end ou seja eu terei 10 dias de vips, dentro da area vip eu tenho um npc q vende uma vocação nova... eu queria que essa vocação acaba-se junto com o vip ex: eu sou master sorcerer, comprei vip e a vocação master sorcerer vip, depois q acabar os 10 dias eu volto a ser master sorcerer... pf alguem ajuda... ?? rep++
Postado Março 26, 2015 10 anos Autor npc king vip 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 item = 2157 -- ID Do item a ser cobrado. local price = 10 -- Quantidade a ser cobrada. local vocations = {5,6,7,8} if(msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion')) then selfSay('Você quer ser promovido vip por '..price..' moedas? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if isInArray(vocations, getPlayerVocation(cid)) then if getPlayerItemCount(cid, item) >= price then if getPlayerVocation(cid) == 5 then doPlayerSetVocation(cid, 9) doPlayerRemoveItem(cid, item, price) end if getPlayerVocation(cid) == 6 then doPlayerSetVocation(cid, 10) doPlayerRemoveItem(cid, item, price) end if getPlayerVocation(cid) == 7 then doPlayerSetVocation(cid, 11) doPlayerRemoveItem(cid, item, price) end if getPlayerVocation(cid) == 8 then doPlayerSetVocation(cid, 12) doPlayerRemoveItem(cid, item, price) end selfSay('Parabens! Você foi promovido vip! ', cid) talkState[talkUser] = 0 else selfSay('Você não tem ' .. price .. ' moedas para ser promovido a vip...', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, você precisa ter a member promotion para ser promovido vip.', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 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())
Postado Março 27, 2015 10 anos Npcking : 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 item = 2157 -- ID Do item a ser cobrado. local price = 10 -- Quantidade a ser cobrada. local vocations = {5,6,7,8} local viptimestorage = 15001 local storage = 91907 if msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then selfSay('Você quer ser promovido vip por '..price..' moedas? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, viptimestorage) >= os.time() then if isInArray(vocations, getPlayerVocation(cid)) then if getPlayerItemCount(cid, item) >= price then if getPlayerVocation(cid) == 5 then doPlayerSetVocation(cid, 9) doPlayerRemoveItem(cid, item, price) setPlayerStorageValue(cid, storage, 1) end if getPlayerVocation(cid) == 6 then doPlayerSetVocation(cid, 10) doPlayerRemoveItem(cid, item, price) setPlayerStorageValue(cid, storage, 1) end if getPlayerVocation(cid) == 7 then doPlayerSetVocation(cid, 11) doPlayerRemoveItem(cid, item, price) setPlayerStorageValue(cid, storage, 1) end if getPlayerVocation(cid) == 8 then doPlayerSetVocation(cid, 12) doPlayerRemoveItem(cid, item, price) setPlayerStorageValue(cid, storage, 1) end selfSay('Parabens! Você foi promovido vip! ', cid) talkState[talkUser] = 0 else selfSay('Você não tem ' .. price .. ' moedas para ser promovido a vip...', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, você precisa ter a member promotion para ser promovido vip.', cid) talkState[talkUser] = 0 end else selfSay('Você precisa ser vip pra ter a promotion', cid) end elseif msg == "no" and talkState[talkUser] >= 1 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()) e cria um arquivo pra colocar isso : function onLogin(cid) local storage = 91907 local viptimestorage = 15001 local player = Player(cid) if player:getStorageValue(cid, viptimestorage) <= os.time() and player:getStorageValue(storage) == 1 then player:setVocation(player:getVocation() - 4) player:setStorageValue(storage, -1) end return true end eu não lembro como é tag do creaturescript.xml em 1.0, mas se tu não souber só avisar. ps : onLogin não registra creature event. #editado #ultimoedit Editado Março 27, 2015 10 anos por Summ (veja o histórico de edições)
Postado Março 27, 2015 10 anos Autor function onLogin(cid)local storage = 91907 local viptimestorage = 15001 local player = Player(cid) if player:getStorageValue(cid, viptimestorage) <= os.time() and player:getStorageValue(storage) == 1 then player:setVocation(player:getVocation() - 4)player:setStorageValue(storage, -1) end return trueend isso é em creaturescript ? (<event type="login" name="PlayerLogin" script="others/login.lua"/>) type eu ponho onlogin ? ou so login e no name ? ps: n sei nada de creaturescript Editado Março 27, 2015 10 anos por maper007 (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.