Ir para conteúdo
  • Cadastre-se

[Pedido] NPC que transfira pontos físicos no jogo em pontos no site


Posts Recomendados

@xWhiteWolf Consegui sumonar o npc mas quando eu falo com ele nessa parte:

22:09 Transferir Pontos: Do you want change 100 Nto Point for 100 premium points in the website?
22:09 GM Vy'n [664]: yes
22:10 GM Vy'n [664]: yes

 

Da esse erro na distro:

lKCNcFr.png

x1fCxnI.png

Link para o post
Compartilhar em outros sites

tenta assim


 

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 function getCount(s)
		local b = s:match('%d+')
		return b and math.min(4294967295, b) or false
	end

----
	local item = 9970

	if msgcontains(msg, 'transfer') then
			selfSay('Please tell me the amount that you want change.', cid)
			talkState[talkUser] = 1
	elseif(getCount(msg) and talkState[talkUser] == 1) then
		count = getCount(msg)
		selfSay('Do you want change ' .. count .. ' '.. getItemNameById(item) ..' for ' .. count .. ' premium points in the website?', cid)
		talkState[talkUser] = 2
	elseif talkState[talkUser] == 2 and msgcontains(msg, 'yes') then
		if getPlayerItemCount(cid, item) >= count then
			if doPlayerRemoveItem(cid, item, count) then
				db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + ".. count .." where id="..getPlayerAccountId(cid))
				selfSay('Very well. You have transfered ' .. count .. ' '.. getItemNameById(item) ..' for ' .. count .. ' premium points.', cid)
				talkState[talkUser] = 0
				npcHandler:releaseFocus(cid)
			else
				selfSay('You do not have the items.', cid)
				talkState[talkUser] = 0
				npcHandler:releaseFocus(cid)
			end
		else
			selfSay('You do not have the items.', cid)
			talkState[talkUser] = 0
			npcHandler:releaseFocus(cid)
		end
	elseif talkState[talkUser] == 2 and msgcontains(msg, 'no') then
		selfSay('Ok then.', cid)
		talkState[talkUser] = 0
		npcHandler:releaseFocus(cid)
	end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo