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

Adding storage values - chests coordinates

Massen

Masserv RPG
Joined
Jul 23, 2007
Messages
324
Reaction score
1
Location
Sweden
So i would love a script that adds a storage value to a player whom open a chests depending on the chests location.

Let me give you an example

player goes to the chest, opens it and recieve the message "Hello, you are here for the first time" and a storage value is added for example coordinates 333,333,7 could pherhaps be storage value 3333337-1000. If he opens the chest again he will recieve the message "You have already been here"



I had this done before but it was depending on a players position he was standing on. and it was a onwalkin script. Now instead i want it for the chests location and with a function onuse.

If anyone is kind enough to create this function / script for me then i would deeply apreciate it. And you will recieve + rep! (atleast something i can do for you.)


With deep respect


//Massen
 
Hello :)

hope this works it's untested made it fast :p

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

local chest = 2222 -- the unique id which you set in the map editor you can change it if you wish :)
local quest = getPlayerStorageValue(cid,FIRST_TIME) --the storage value which will be set

	if item.uid == chest and quest == -1 then
		doPlayerSendTextMessage(cid,22, "Hello, you are here for the first time")
		doSetPlayerStorageValue(cid,FIRST_TIME,1)

		else
			doPlayerSendTextMessage(cid,22, "You have already been here")
	end
end

and add this into actions.xml

PHP:
<action uniqueid="the unique id from the script" script="nameofthescript.lua" />

yours Evil Hero,
 
Last edited:
Hello :)

hope this works it's untested made it fast :p

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

local chest = 2222 -- the unique id which you set in the map editor you can change it if you wish :)
local quest = getPlayerStorageValue(cid,FIRST_TIME) --the storage value which will be set

	if item.uid == chest and quest == -1 then
		doPlayerSendTextMessage(cid,22, "Hello, you are here for the first time")
		doSetPlayerStorageValue(cid,FIRST_TIME,1)

		else
			doPlayerSendTextMessage(cid,22, "You have already been here")
	end
end

and add this into actions.xml

PHP:
<action uniqueid="the unique id from the script" script="nameofthescript.lua" />

yours Evil Hero,

Well the reason i want this is becouse i want a quest whith and action id that i can spread over the map... will this work if i change it into an action id and place it at different locations (you can open all chests once each)

thanks for your time! :)

//Massen
 
If you place more than one you can only open one of the chests, if you try to open another one it will just tell you that it's empty.
 
I'm not 100% sure but i think you'll have to use different unique id's and different StorageValues to do that I'll try to make it possible when i get more time :)

P.S: I'm kinda interested why you want it like this becouse it doesn't make sence at all for me :p

yours Evil Hero,
 
Last edited:
Well the reason i want this is becouse i want a quest whith and action id that i can spread over the map... will this work if i change it into an action id and place it at different locations (you can open all chests once each)

thanks for your time! :)

//Massen

Its working for me, thanks too the one who scripted it.
 
You can do the position check then add the storage value to the player depending on the pos, but that takes some lines and is useless when you can just use different action/unique IDs.
 
Back
Top