• 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!

Experience !!

Nashalito

New Member
Joined
May 21, 2009
Messages
273
Reaction score
0
Hello, i have got a little problem
When i have 100x experience item. All does removes when i try to use . I want that it just will use one att the time.
How can i fix it ? i got tfs 0.3.6
i use this script :

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        
            if(doPlayerAddExperience(cid, 1000) == TRUE) then
            doCreatureSay(cid, "You Gained 1 000 Experience Points UP!!", TALKTYPE_ORANGE_1)
            doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
            doRemoveItem(item.uid)
            return TRUE
end
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return doPlayerAddExperience(cid, 1000) and doCreatureSay(cid, "You have received 1000 experience points!", TALKTYPE_ORANGE_1) and doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) and doRemoveItem(item.uid)
end
 
And you did what ? :p

here it is
Lua:
local maxx = 349349   -- max exp
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerExperience(cid) >= maxx then
		return doPlayerSendCancel(cid,"You cant use this any more.")
	end
	return doPlayerAddExperience(cid, 1000) and doCreatureSay(cid, "You have received 1000 experience points!", TALKTYPE_ORANGE_1) and doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) and doRemoveItem(item.uid,1)
end
 
Last edited:
But how can i do that it will not work if i have more than 7915800 expeience?? i want that it will not work. how ca n i do that?
 
And you did what ? :p

Made it work for him? Duh? :confused:

@Nash,
You can check for a level.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local level = 100
	local msg = "Sorry, but your level is too high."
	return getPlayerLevel(cid) < level and doPlayerAddExperience(cid, 1000) and doCreatureSay(cid, "You have received 1000 experience points!", TALKTYPE_ORANGE_1) and doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) and doRemoveItem(item.uid) or doPlayerSendCancel(cid, msg) and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
 
Made it work for him? Duh? :confused:

@Nash,
You can check for a level.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local level = 100
	local msg = "Sorry, but your level is too high."
	return getPlayerLevel(cid) < level and doPlayerAddExperience(cid, 1000) and doCreatureSay(cid, "You have received 1000 experience points!", TALKTYPE_ORANGE_1) and doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) and doRemoveItem(item.uid) or doPlayerSendCancel(cid, msg) and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end

He said when he use the item that have 100 charges they are all removed he need only 1 be removed so you have actually done nothng :p

it should be doRemoveItem(item.uid,1)
 
Back
Top Bottom