Jump to content

Problem with settings on meta.xml


Shuubaru

Recommended Posts

Hi, I got a problem with the "settings" on my script. I set in the meta the following:

 

<settings>
	<setting 
		name="*skinsPrice" 
		value="2500"
		group="Price"
		desc="Set the price of the skins."
	/>
</settings>


But when I try to edit the value I got this error:

0f3a6d0527.png

Basically, if I edit one, another setting is created with the value I set, and the old setting is not changed.

If I use get() function like this:

function saveSkinPrice (skinsResource)
	if skinsResource ~= getThisResource() then return end
	local currentSkinPrice = get("skinsPrice")
	--I use the setElementData to retrieve the value on client side
	setElementData(resourceRoot, "skins.price", currentSkinPrice )
end
addEventHandler("onResourceStart", getRootElement(), saveSkinPrice)

function updateSkinPrice(pricesetting, oldprice, newprice)
	--outputs for testing
	outputChatBox(pricesetting) 
	outputChatBox(oldprice)
	outputChatBox(newprice)

	local currentSkinPrice = get("skinsPrice")
	setElementData(resourceRoot, "skins.price", currentSkinPrice )
end
addEventHandler("onSettingChange", getRootElement(), updateSkinPrice)

It retrieve the value from "iG_infernus-skins.skinsPrice" setting, making the setting "skinsPrice" useless. I can only use it to edit the "iG_infernus-skins.skinsPrice" setting, and that doesn't have any sense.

Link to comment
2 hours ago, MIKI785 said:

So youre saying that whenever you edit the setting in admin it doesnt change it but creates a new one instead? Thats really strange and it looks like the bug is in admin. Try changing the resource name so that it doesnt contain a dash (-) character.

I deleted the dash character and now it works. Thanks. I didn't expected to have problems with that character, should I send a bug report? Because I didn't see anything about that on bugs.mtasa.com

Link to comment
3 hours ago, Shuuichi said:

I deleted the dash character and now it works. Thanks. I didn't expected to have problems with that character, should I send a bug report? Because I didn't see anything about that on bugs.mtasa.com

Well you might, it's not supposed to be happening because dash is a legal character for resource names. It's most likely a bug in admin resource and not MTA itself. But i could test that to be sure.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...