• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Remove or transform playerstoragavalue

menfes

Sociopat
Joined
Feb 7, 2009
Messages
380
Reaction score
4
Location
Space
I wonder if it is possible to remove a players storagevalue in some way, or maybe it's not needed in my case either. I want to have a quest which u can make many times as u want, but u need to w8 some time before being able to do it again, or talk to an npc to remove your storagevalue. Hope u understand me :p:D:p
 
Last edited:
Hm. You can use addEvent() function I think ;p.
Code:
addEvent(doPlayerSetStorageValue, [COLOR="YellowGreen"]TIME[/COLOR], cid, [COLOR="Orange"]STORAGE[/COLOR], [COLOR="Plum"]VALUE[/COLOR])
TIME - here you must set delay of change storage value.
STORAGE - here set storage
VALUE - here set value

I think it's ok.
 
Can u please give an example, cuz i dont really get how to make this thing happen.
Code:
function onUse(cid, item, frompos, item2, topos)

	if item.uid == 3458 then
 	queststatus = getPlayerStorageValue(cid,123458)
 	if queststatus == -1 then
 	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a manarune.")
 	doPlayerAddItem(cid,2296,1)
 	setPlayerStorageValue(cid,123458,1)
 	else
 	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"It is empty.")
	end
	else
	return 0
	end
	
	return 1
	end
If u can take this script as example :)
 
This should do it. Didn't test it so may contain errors.

Lua:
function onUse(cid, item, frompos, item2, topos)

	local timeToWait = 2 -- minutes!
	if item.uid == 3458 then
	 	local queststatus = getPlayerStorageValue(cid,123458)
	 	if queststatus + (timeToWait * 60) < os.time then
		 	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have found a manarune.")
		 	doPlayerAddItem(cid,2296,1)
		 	setPlayerStorageValue(cid,123458,os.time())
	 	else
		 	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"It is empty.")
		end
	else
		return false
	end
	
	return true
end
 
Last edited:
Error:
Code:
[08/09/2009 14:23:18] Lua Script Error: [Action Interface] 
[08/09/2009 14:23:18] data/actions/scripts/quests/300quest/chest 2.lua:onUse

[08/09/2009 14:23:18] data/actions/scripts/quests/300quest/chest 2.lua:6: attempt to compare number with function
[08/09/2009 14:23:18] stack traceback:
[08/09/2009 14:23:18] 	data/actions/scripts/quests/300quest/chest 2.lua:6: in function <data/actions/scripts/quests/300quest/chest 2.lua:1>
Hope u can fix that :p
 
Ok, the quest worked, now i w8 2 min to see if i can re-do the quest :p

You are the best xD
It worked!
 
Back
Top