Jump to content
Close
Andreselos1988

PEDIDO Segunda promotion VIP e NPC [TFS 1.0]

Recommended Posts

Fala galera, preciso de um npc que venda a segunda promotion, e esse npc só vai ter na area vip, ou seja só vip pode ter a segunda promotion, segue o código da promotion que eu criei se tiver algo errado por favor me corrijam.

<vocation id="9" clientid="3" name="Noble Master Sorcerer" description="a noble master sorcerer" gaincap="10" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="20" gainmanaticks="1" gainmanaamount="50" manamultiplier="1.1" attackspeed="1500" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1">


        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="2.0"/>
        <skill id="1" multiplier="2.5"/>
        <skill id="2" multiplier="2.5"/>
        <skill id="3" multiplier="2.5"/>
        <skill id="4" multiplier="2.5"/>
        <skill id="5" multiplier="2.0"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>
    <vocation id="10" clientid="4" name="Noble Elder Druid" description="an noble elder druid" gaincap="10" gainhp="5" gainmana="30" gainhpticks="2" gainhpamount="20" gainmanaticks="1" gainmanaamount="50" manamultiplier="1.1" attackspeed="1500" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="2.0"/>
        <skill id="1" multiplier="2.3"/>
        <skill id="2" multiplier="2.3"/>
        <skill id="3" multiplier="2.3"/>
        <skill id="4" multiplier="2.3"/>
        <skill id="5" multiplier="2.0"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>
    <vocation id="11" clientid="2" name="Noble Royal Paladin" description="a noble royal paladin" gaincap="20" gainhp="10" gainmana="15" gainhpticks="2" gainhpamount="25" gainmanaticks="1" gainmanaamount="35" manamultiplier="1.4" attackspeed="1400" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="1.7"/>
        <skill id="1" multiplier="1.7"/>
        <skill id="2" multiplier="1.7"/>
        <skill id="3" multiplier="1.7"/>
        <skill id="4" multiplier="1.6"/>
        <skill id="5" multiplier="1.6"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>
    <vocation id="12" clientid="1" name="Noble Elite Knight" description="an noble elite knight" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="30" gainmanaticks="1" gainmanaamount="20" manamultiplier="3.0" attackspeed="1300" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>
        <skill id="0" multiplier="1.6"/>
        <skill id="1" multiplier="1.6"/>
        <skill id="2" multiplier="1.6"/>
        <skill id="3" multiplier="1.6"/>
        <skill id="4" multiplier="1.9"/>
        <skill id="5" multiplier="1.6"/>
        <skill id="6" multiplier="1.6"/>
    </vocation>

 

Essa promotion upara os skills mais rapidamente, eu alterei nos skill id, não sei se ta certo, mas pela lógica eu axo que eh ali mesmo, enfim o sistema vip que eu uso usa a storage 9999 se ajudar, esse eh o meu vip system:
https://otland.net/threads/vip-system-the-forgotten-server-1-0.224910/#post-2163589

Gostaria de um npc que de a segunda promotion só se o player tiver vip, por dinheiro normal do jogo, e que quando acabasse a vip, voltasse a ser promotion 1 (master sorcerer, etc..) e que só consiga ter a promotion 2 se tiver a promotion 1, lembrando que eu uso TFS 1.0, obrigado desde já!
 


Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower, 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

em creaturescripts :

 

function onLogin(cid)

	local storage = 14542;
	player = Player(cid);

	if player:getVipDays() == 0 and player:getStorageValue(storage) == 1 then
		player:setVocation(player:getVocation() - 4)
		player:setStorageValue(storage, - 1)
	end
	
	return true
end

Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites
local money = xxxx, -- Quanto vai custar
local storage = 14542, -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)]
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower, 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

em creaturescripts :

 

function onLogin(cid)

	local storage = 14542;
	player = Player(cid);

	if player:getVipDays() == 0 and player:getStorageValue(storage) == 1 then
		player:setVocation(player:getVocation() - 4)
		player:setStorageValue(storage, - 1)
	end
	
	return true
end

Obrigado vou testar, aonde ta local storage = 14542, -- Não mexer

pode colocar 9999?



1545517_5.png

Share this post


Link to post
Share on other sites

Cara deixa a storage que tá ... se trocar vai dar problema e pra que tu quer mudar pra essa storage "9999"?



EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Cara deixa a storage que tá ... se trocar vai dar problema e pra que tu quer mudar pra essa storage "9999"?

Okay nao mudei nada, porem ta dando esse erro na distro

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:2: unexpected symbol near 'local'

ps: eu queria trocar pra 9999 pq é a storage da vip, e eu pensei que essa linha tinha algo a ver..


Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

Tente agora editei la em cima... eu tinha colocado uma "," no final rsrsr



EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Tente agora editei la em cima... eu tinha colocado uma "," no final rsrsr

hahaha okay, agora deu esse erro..

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:26: unexpected symbol near ']'

 



1545517_5.png

Share this post


Link to post
Share on other sites

editei dnv KAOSKAPOSK, isso que dá fazer script na madrugada...



EQD4Qy4.gif

Share this post


Link to post
Share on other sites

editei dnv KAOSKAPOSK, isso que dá fazer script na madrugada...

UAHSUHASUHAS pega nada cara, o que importa eh vc estar me ajudando, e segue ae mais um erro SAUHUHSAUHAS

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:30: function arguments expected near ','

 



1545517_5.png

Share this post


Link to post
Share on other sites
local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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


EQD4Qy4.gif

Share this post


Link to post
Share on other sites
local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Aeee esse nao deu erro \o vou testar, e ja aviso aqui se deu certo!

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Cara funcionou numa boa o npc, mas quando vou colocar a segunda promotion ela responde assim

13:42 Queen Alice: you no have first promotion

ps: já ta com a primeira promotion


Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

Tente :

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		for x = 5, 8 do	
			if player:getVocation() == x then
				break
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

#editado


Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Tente :

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		for x = 5, 8 do	
			if player:getVocation() == x then
				break
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

#editado

deu a mesma coisa

13:42 Queen Alice: you no have first promotion

ps: já ta com a primeira promotion



1545517_5.png

Share this post


Link to post
Share on other sites

:hum:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
                print(player:getVocation)
		for x = 5, 8 do	
			if player:getVocation() == x then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        		break
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

eu coloquei pra printar algo no console da uma olhada pra mim que numero aparece...


Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

:hum:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
                print(player:getVocation)
		for x = 5, 8 do	
			if player:getVocation() == x then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        		break
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

eu coloquei pra printar algo no console da uma olhada pra mim que numero aparece...

No console que vc fala eh no distro? se for nao aparece nada, e continua a mesma coisa >.<

 



1545517_5.png

Share this post


Link to post
Share on other sites

Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console...

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
        print(player:getVocation())
			if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

 

Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console...

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
        print(player:getVocation())
			if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

agora apareceu isto quando estava dando loading no server:

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:52: 'end' expected (to close 'function' at line 13) near 'elseif'

 



1545517_5.png

Share this post


Link to post
Share on other sites

Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo.

Tenta dnv com o code acima.



EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo.

Tenta dnv com o code acima.

hehehe não tinha visto, apareceu esse código no distro quando fala "yes"

userdata: 0x7f02c8068b58

Conseguiu amigo? Estou no aguardo :D


Edited by Andreselos1988 (see edit history)

1545517_5.png

Share this post


Link to post
Share on other sites

Não testei:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if player:getPromotion() == 1 then
		    if player:getVipDays() >= 1 then
		       	if player:removeMoney(money) then
		       		npcHandler:say('you just received a new promotion', cid)
		       		player:setVocation(player:getVocation() + 4)
		       		player:setStorageValue(storage, 1)
		       		npcHandler.topic[cid] = 0
		       	else
		       		npcHandler:say('you no have money', cid)
		       		npcHandler.topic[cid] = 0
		       	end
		    else
		       	npcHandler:say('You do not have any vip days.', cid)
		       	npcHandler.topic[cid] = 0
		    end
		else
		   	npcHandler:say('you no have first promotion', cid)
		   	npcHandler.topic[cid] = 0
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Edited by Summ (see edit history)

EQD4Qy4.gif

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia começando do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer fazer um plano publicitário para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução!

×
×
  • Create New...