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

Set Storage Value

Ward_214

Pro PvP
Joined
Dec 11, 2008
Messages
297
Reaction score
0
I need LUA script that sets a players storage value to 45000.

For example, medal of honour.. I use and get storage value 45000. Then I am able to use a talkaction or door or whatever

Thanks!
 
Lua:
local s = 1234 -- storage
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, s) >= 1 then
		doPlayerSendCancel(cid, "Sorry, you've already used this item")
	else
		setPlayerStorageValue(cid, s, 1)
	end
return TRUE
end
 
It just keeps sending the error.

Here's the script
Code:
local s = 45000 -- storage
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 45000) >= 1 then
		doPlayerSendCancel(cid, "Sorry, you've already used this item")
	else
		setPlayerStorageValue(cid, 45000, 1)
	end
return TRUE
end

The character has NOT had the storage value before. I made a new character to make sure.
 
Lua:
local s = 4500 -- storage
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, s) >= 1 then
		doPlayerSendCancel(cid, "Sorry, you've already used this item")
	else
		setPlayerStorageValue(cid, s, 1)
	end
return TRUE
end
Don't edit.
 
You use local s =
need change in your script 45000 for s

example:

Lua:
setPlayerStorageValue(cid, 45000, 1)

for

Lua:
setPlayerStorageValue(cid, s, 1)

@edit
use Bogart script
 
well that script is perfect so youre doing something else wrong, check your actions.xml you probly messed it up
post the errors you are getting, how are we supposed to help if we duno what the problem is?
 
This is the actions.xml. Which I know is correct.
Code:
<action itemid="5785" event="script" value="other/tpdoll.lua"/>

This is the talkaction I want the player to get when using the doll..
Code:
local teleport = {
	['depot'] = {x=1032, y=1002, z=7},
	['temple'] = {x=1000, y=995, z=7},	
	['monster tele'] = {x=830, y=826, z=7},
	['quests'] = {x=830, y=826, z=7},
	['quest tele'] = {x=830, y=826, z=7},
	['trainers'] = {x=994, y=865, z=7},
}
 
function onSay(cid, words, param, channel)
	if (getPlayerStorageValue(cid, 45000) == 1) then
		local s = teleport[param:lower()]
		if (s) then
			if not(isPlayerPzLocked(cid)) then
				doTeleportThing(cid, s)
				doSendMagicEffect(s, CONST_ME_TELEPORT)
			else
				doPlayerSendCancel(cid, 'You are PZlocked.')
			end
		else
			doPlayerSendCancel(cid, 'Destination doesn\'t exist.')
		end
		return true
	end
	doPlayerSendCancel(cid, 'You haven\'t bought this talkaction.')
	return false
end
 
Back
Top