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

donation exp chest (works with some error)

Triggah

TrigCore
Joined
Aug 1, 2007
Messages
436
Reaction score
2
fixed the boolean thing but i cant fixure out how to make this usable again after using it 25 times and (in my server when u log out ur char reset back to wat it was but storage values/quests stay) i have 2 scripts. Also when player uses the storage id that gives the player ability to use the chest, if person relogs he/she cant use donation chest again (even if didnt use 25 uses).
Code:
function onUse(cid, item, frompos, item2, topos)

--config--
local VIPstorage = 11552 --storage id of VIP feature--
local Message = "CONGRATULATIONS! You are now a able to use Exp Chest!" --message when successful--
local CancelMSG = 'Error in script.' --error message--
local AniMSG = "Exp!" --max of 9 characters (includes spaces)--
--end config--

	if getPlayerLevel(cid) > 1 then
		doSendAnimatedText(getPlayerPosition(cid), AniMSG, TEXTCOLOR_RED) 
		doCreatureSay(cid, Message, TALKTYPE_ORANGE_1)
		setPlayerStorageValue(cid, VIPstorage, 1)
		doRemoveItem(item.uid, 1)
	else
		doPlayerSendCancel(cid, CancelMSG)
	end
return TRUE
end
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	 --config--
	local EXPamount = 28118000 --amount of exp player recieves for each use.
	local VIPstorage = 11552 --the storage of you VIP system.
	local USEstorage = 12341 --is the storage used to store amount of uses, can be any storage not used.
	local notdonator = "Only donators may use this chest" --message received if player is not a donator.
	local nomoreuses = "You have used all of your 25 uses of this chest" -- received if player has no more uses.
	local maxuses = 25
	--end config--
	
		if(getPlayerStorageValue(cid, VIPstorage) == 1) and (getPlayerStorageValue(cid, USEstorage) <= maxuses) then
			doPlayerAddExperience(cid, EXPamount)
			setPlayerStorageValue(cid, USEstorage, (getPlayerStorageValue(cid, USEstorage)+1))
		elseif(getPlayerStorageValue(cid, VIPstorage) == 1) and (getPlayerStorageValue(cid, USEstorage) > maxuses) then		
			doPlayerSendCancel(cid, nomoreuses)
			return false
		else
			doPlayerSendCancel(cid, notdonator)	
			return false
		end
	return true
end
 
Back
Top