• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC for only Premium Player

GuHB

Member
Joined
Dec 14, 2009
Messages
630
Reaction score
9
Location
Brazil
How can i do this NPC here to talk for only PREMIUM PLAYERS?

XML:
<?xml version="1.0"?>
<npc name="Alexander" script="default.lua" walkinterval="2000">

  <health now="200" max="200" />
  <look type="130" head="96" body="63" legs="71" feet="97" addons="0"/>
  <parameters>
        
<parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="rust remover,9930,500;terra rod,2181,10000;snakebite rod,2182,500;necrotic rod,2185,5000;moonlight rod,2186,1000;underworld rod,8910,22000;northwind rod,8911,7500;springsprout rod,8912,18000;hailstorm rod,2183,15000;wand of decay,2188,5000;wand of cosmic energy,2189,10000;wand of vortex,2190,500;wand of dragonbreath,2191,1000;wand of draconia,8921,7500;wand of starstorm,8920,18000;wand of voodoo,8922,22000;wand of inferno,2187,15000;life ring,2168,900" />
        <parameter key="shop_sellable" value="might ring,2164,2000;stealth ring,2165,5000;dwarven ring,2213,1750;energy ring,2167,650;ring of healing,2214,1200;spellbook of enlightenment,8900,4000;spellbook of lost souls,8903,19000;spellbook of mind control,8902,13000;spellbook of warding,8901,8000;life crystal,2177,900" />
    
</parameters>

</npc>

Thanks.
 
Test this

PHP:
<?xml version="1.0"?>
<npc name="Alexander" script="default.lua" walkinterval="2000" Premium="1">
 
  <health now="200" max="200" />
  <look type="130" head="96" body="63" legs="71" feet="97" addons="0"/>
  <parameters>
 
<parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="rust remover,9930,500;terra rod,2181,10000;snakebite rod,2182,500;necrotic rod,2185,5000;moonlight rod,2186,1000;underworld rod,8910,22000;northwind rod,8911,7500;springsprout rod,8912,18000;hailstorm rod,2183,15000;wand of decay,2188,5000;wand of cosmic energy,2189,10000;wand of vortex,2190,500;wand of dragonbreath,2191,1000;wand of draconia,8921,7500;wand of starstorm,8920,18000;wand of voodoo,8922,22000;wand of inferno,2187,15000;life ring,2168,900" />
        <parameter key="shop_sellable" value="might ring,2164,2000;stealth ring,2165,5000;dwarven ring,2213,1750;energy ring,2167,650;ring of healing,2214,1200;spellbook of enlightenment,8900,4000;spellbook of lost souls,8903,19000;spellbook of mind control,8902,13000;spellbook of warding,8901,8000;life crystal,2177,900" />
 
</parameters>
 
</npc>
 
Test this

XML:
<?xml version="1.0"?>
<npc name="Alexander" script="default.lua" walkinterval="2000" Premium="1">
 
  <health now="200" max="200" />
  <look type="130" head="96" body="63" legs="71" feet="97" addons="0"/>
  <parameters>
 
<parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="rust remover,9930,500;terra rod,2181,10000;snakebite rod,2182,500;necrotic rod,2185,5000;moonlight rod,2186,1000;underworld rod,8910,22000;northwind rod,8911,7500;springsprout rod,8912,18000;hailstorm rod,2183,15000;wand of decay,2188,5000;wand of cosmic energy,2189,10000;wand of vortex,2190,500;wand of dragonbreath,2191,1000;wand of draconia,8921,7500;wand of starstorm,8920,18000;wand of voodoo,8922,22000;wand of inferno,2187,15000;life ring,2168,900" />
        <parameter key="shop_sellable" value="might ring,2164,2000;stealth ring,2165,5000;dwarven ring,2213,1750;energy ring,2167,650;ring of healing,2214,1200;spellbook of enlightenment,8900,4000;spellbook of lost souls,8903,19000;spellbook of mind control,8902,13000;spellbook of warding,8901,8000;life crystal,2177,900" />
 
</parameters>
 
</npc>

Dont have effect man.. Dont work, free can sell and buy normaly
 
You could add a great callback in your npc.lua~~ like this:

LUA:
function greetCallback(cid)
	if not(isPremium(cid)) then
		npcHandler:say('I only talk to wise players.')
		return false
	else
		return true
	end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
Wow you got a new avatar picture. Now I don't need to hate you anymore :>

Why the hate?

Inside? Where?
Inside your npc LUA script, right after the function line.
i.e.
LUA:
function smokeDeJonko()
	if not(isPremium(cid))then
		npcHandler:say('I only talk to wise players.')
		npcHandler:releaseFocus(cid)
		return true
	end
 
I really dont understand.

Here's the lua file
LUA:
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


npcHandler:addModule(FocusModule:new())

Where shoul i put it? -.-'
 
LUA:
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
function greetCallback(cid)
	if not(isPremium(cid)) then
		npcHandler:say('I only talk to wise players.')
		return false
	else
		return true
	end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

 
npcHandler:addModule(FocusModule:new())
 
@Zysen
Won't work..

Try this, but don't put it in default.lua! Create a new file and register that in your npc .xml..
LUA:
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
 
function greetCallback(cid)
	if not(isPremium(cid)) then
		npcHandler:say('I only talk to wise players.')
		return false
	end
	return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top