Ir para conteúdo

Featured Replies

Postado

Fala Galerinha Do TK

Estou Com Um NPC DE Presente Diario Criado Pelo VODCART

Gostaria De Que Colocasse Ele Pra Verificar O IP Do player

Para Que Eles Nao Criar Mcs E Ficar Pegando o Presente Toda Hora

Segue O Script

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 msg = string.lower(msg)

local config = {

hours = 24,

storage = 58485,

rewards = {{itemid = 11192,chance = 30}} -- itens que ele poderá ganhar 

}

function doAddReward()

a = true

while a == true do

local m = math.random(1,#config.rewards)

if config.rewards[m].chance > math.random(1, 100) then

doPlayerAddItem(cid, config.rewards[m].itemid, isItemStackable(config.rewards[m].itemid) and 100 or 1)

npcHandler:say("seu prêmio foi: "..getItemNameById(config.rewards[m].itemid), cid)

a = false

end

end

end

if isInArray({"presente","present"}, msg) then

npcHandler:say("você deseja receber seu presente agora?! {yes}", cid)

talkState[talkUser] = 1

elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if getPlayerStorageValue(cid,config.storage) <= os.time() then

doAddReward()

setPlayerStorageValue(cid, config.storage, os.time()+config.hours*3600)

else

npcHandler:say("Desculpe, mas você deve aguardar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,config.storage)).." para pegar seu presente novamente!", cid)

talkState[talkUser] = 0

end

elseif msg == "no" 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())

 

Obrigado 

+REP


 

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo