• 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 Sell hp + mana

SnowFox

New Member
Joined
May 18, 2008
Messages
264
Reaction score
0
Hello OTLand,
Im looking for a NPC script were the NPC sells HP and Mana to player
Example:
100cc = buy 20 hp
100cc = buy 20 mana

If player have 100 HP and buys 20hp his hp becomes 120 FOREVER and NPC takes 100cc

Understand what i mean?

I really need this Script for my OT and if its possible and someone has it can you please share it +rep thanks.
 
BUMP:
Even if it was with Actions, lets say the person uses a lever and levers takes 100cc and adds 20 hp to their max health, or mana
 
try this ;s
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
            if doPlayerRemoveMoney(cid, ITEM_CRYSTAL_COIN, 100) == true then
                    doCreatureAddHealth(cid, getCreatureMaxHealth(cid)+10)
            else
                    doPlayerSendCancel(cid, "You dont have enough money.")
            end
            return true
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if doPlayerRemoveMoney(cid, 1000000) then
		return setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+20)
	end
	return doPlayerSendCancel(cid, "You don't have enough money.")
end
 
Code:
	return doPlayerSendCancel(cid, "You don't have enough money.")
_[?]_ that will give him the cancel msg each time he uses it even if he has the money
Code:
return setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+10) or doPlayerSendCancel(cid, "You don't have enough money.")
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}

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)
	local cfg = {
		cost = 1000000, hp = 20
	}
	if not npcHandler:isFocused(cid) then
		return false
	elseif msgcontains(msg, 'add health') or msgcontains(msg, 'buy hp') then
		npcHandler:say("Would you like to buy " .. cfg.hp .. " health for " .. cfg.cost .. "gp?", cid)
		Topic[cid] = 1
	elseif Topic[cid] == 1 then
		if msgcontains(msg, 'yes') then
			if doPlayerRemoveMoney(cid, cfg.cost) then
				npcHandler:say('Here you are.', cid)
				setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + cfg.hp)
			else
				npcHandler:say('You don\'t have enough money.', cid)
			end
		else
			npcHandler:say('Then not.')
		end
		Topic[cid] = 0
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}

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)
	local cfg = {
		cost = 1000000, hp = 20
	}
	if not npcHandler:isFocused(cid) then
		return false
	elseif msgcontains(msg, 'add health') or msgcontains(msg, 'buy hp') then
		npcHandler:say("Would you like to buy " .. cfg.hp .. " health for " .. cfg.cost .. "gp?", cid)
		Topic[cid] = 1
	elseif Topic[cid] == 1 then
		if msgcontains(msg, 'yes') then
			if doPlayerRemoveMoney(cid, cfg.cost) then
				npcHandler:say('Here you are.', cid)
				setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + cfg.hp)
			else
				npcHandler:say('You don\'t have enough money.', cid)
			end
		else
			npcHandler:say('Then not.')
		end
		Topic[cid] = 0
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Every post is a repost of a repost.
 
_[?]_ that will give him the cancel msg each time he uses it even if he has the money
Code:
return setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+10) or doPlayerSendCancel(cid, "You don't have enough money.")

Actually your example sux too, it'll give hp or send cancel, not remove money.
 
lol wat? you mad bro?

Something is wrong with you, i just wanted to write that your example isn't excatly what you could show.

Code:
return doPlayerRemoveMoney(cid, 1337) and setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 10) or doPlayerSendCancel(cid, "You don't have enough money.")

And don't call me bro, you bad imitation of Cykotitan.
 
Something is wrong with you, i just wanted to write that your example isn't excatly what you could show.

Code:
return doPlayerRemoveMoney(cid, 1337) and setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 10) or doPlayerSendCancel(cid, "You don't have enough money.")

And don't call me bro, you bad imitation of Cykotitan.
thought you had me on your ignore list. pwned?
 
People don't know how to use search. <_<

Search is almost useless in this situation because people don't know how to create a thread... request threads with the name "this wont work" or "big bug" or "help please" ect... they don't really describe the problem they are having so if someone solves it and someone else searches for the same problem they are never going to find that one thread that actually had the answer.
 
Back
Top