Postado Agosto 11, 2019 5 anos Galera tenho esse script de vocation vip, preciso que ele tenha um limite de lvl que seria 20 pro item poder ser usado... Mostrar conteúdo oculto function onThink(cid, interval) local itemid = 13489 local outfit = {lookType = 353} if isPlayer(cid) then if getPlayerItemCount(cid, itemid) >= 1 then if getPlayerStorageValue(cid,30023) == 4 then doPlayerSetVocation(cid, 442) else doPlayerSetVocation(cid, 437) end doPlayerRemoveItem(cid, itemid, 1) doCreatureChangeOutfit(cid, outfit) addEvent(doRemoveCreature, 1, cid) end end return true end
Postado Agosto 12, 2019 5 anos Tenta assim: function onThink(cid, interval) local itemid = 13489 local outfit = {lookType = 353} if isPlayer(cid) then if getPlayerLevel(cid) <= 20 then if getPlayerItemCount(cid, itemid) >= 1 then if getPlayerStorageValue(cid,30023) == 4 then doPlayerSetVocation(cid, 442) else doPlayerSetVocation(cid, 437) end doPlayerRemoveItem(cid, itemid, 1) doCreatureChangeOutfit(cid, outfit) addEvent(doRemoveCreature, 1, cid) end end end return true end Baiak Thunder New TFS Downgrade [TFS 1.5 - 8.60] Gesior Ferobra Downgrade Evento Monster Hunt [TFS 1.X] Evento SafeZone [TFS 1.X] Online Bonus System [TFS 1.X] Dodge & Critical [TFS 1.X] Nova moeda, funcionando com NPCs [TFS 1.X] Square System [TFS 1.X] Loot Channel [TFS 1.X] Gerenciador de Quests [All TFS] NPCs comprando vial/flasks por storage [TFS 1.X] AntiBot [TFS 1.X] Como compilar TFS 0.X
Postado Agosto 12, 2019 5 anos Autor Em 12/08/2019 em 01:00, movie disse: Tenta assim: function onThink(cid, interval) local itemid = 13489 local outfit = {lookType = 353} if isPlayer(cid) then if getPlayerLevel(cid) <= 20 then if getPlayerItemCount(cid, itemid) >= 1 then if getPlayerStorageValue(cid,30023) == 4 then doPlayerSetVocation(cid, 442) else doPlayerSetVocation(cid, 437) end doPlayerRemoveItem(cid, itemid, 1) doCreatureChangeOutfit(cid, outfit) addEvent(doRemoveCreature, 1, cid) end end end return true end amigo funcionou sim, porem errei em uma coisa, preciso q o npc nao venda se o player for level maior que 20, aqui esta o script do npc Mostrar conteúdo oculto 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 items = { item1 = {6544, 13489}, -- item1 item que será pedido e que será dado na primeira troca } local counts = { count1 = {25, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca } 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, 'kagome') then selfSay('Voce deseja paga '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' por'.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'?',cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then doPlayerRemoveItem(cid, items.item1[1], counts.count1[1]) doPlayerAddItem(cid, items.item1[2], counts.count1[2]) selfSay('Obrigado! Voce acaba de paga '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' por '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid) talkState[talkUser] = 0 else selfSay('Voce precisa de '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid) end end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Agosto 12, 2019 5 anos Solução 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 items = { item1 = {6544, 13489}, -- item1 item que será pedido e que será dado na primeira troca } local counts = { count1 = {25, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca } 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, 'kagome') then selfSay('Voce deseja paga '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' por'.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'?',cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then if getPlayerLevel(cid) <= 20 then if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then doPlayerRemoveItem(cid, items.item1[1], counts.count1[1]) doPlayerAddItem(cid, items.item1[2], counts.count1[2]) selfSay('Obrigado! Voce acaba de paga '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' por '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid) talkState[talkUser] = 0 else selfSay('Voce precisa de '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid) end else selfSay('Voce precisa ter no maximo level 20.', cid) end end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
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.