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

Lua getGlobalStorageValue error

resho

New Member
Joined
Nov 9, 2008
Messages
70
Reaction score
0
Location
East Europe
Code:
function onThink(cid, interval, lastExecution)
if (getGlobalStorageValue(20000) == 1) then
doBroadcastMessage ("bigger")
end
if (getGlobalStorageValue(20000) == 0) then
doBroadcastMessage ("smaller")
end
end

This is my db
crop.png

And ALWAYS I GET RESULT -1 :(
What is wrong there?
 
If not necessary to check for 0, then make it like this. I'm not sure what the problem is :S

Lua:
function onThink(cid, interval, lastExecution)
	if getGlobalStorageValue(20000) < 1 then
		doBroadcastMessage ("smaller")
	else
		doBroadcastMessage ("bigger")
	end
end

You might have to make a save for it to change in the db (if that's the problem lulz)
 
Last edited:
It is like a player, you cannot set a value in the database while the player is already online, if you want it to do what you want it to so, you have to use say a talk action and use setGlobalStorageValue(20000, 1) then the server knows its value
 
Exactly it will save back to -1, something in the server needs to tell it to go to value 1 he is talking about changing in database manually while server is running
 
Back
Top