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

to call field 'getDataInt' (a nil value)?

Narzerus

Full-stack developer and old OT Developer
Joined
Oct 29, 2007
Messages
202
Reaction score
11
I get this error message randomly

Happens at random moments when someone uses my donator tokens.

The script that is causing trouble is the following

Code:
function isPlayerDonator(cid)
	local result = db.getResult("SELECT `isdonator` FROM `accounts` WHERE `id` = '"..getPlayerAccountId(cid).."'")
	local isdonator
	if(result:getID() ~= -1) then
		isdonator = result:getDataInt("isdonator")
	end
	if isdonator == 1 then
		return true
	else
		return false
	end
end

The error I suddenly get after executing the function a couple of times is
attempt to call field 'getDataInt' (a nil value)

Even though the value is by default 0, and if not, it's 1 (when player is a donator).
After the function shows this error, it starts happening each time the function is used.


Thanks!
 
It is an integer parameter. Do you think that changing the system to compare a string would work?
 
Well I changed it the script to handle a string instead
GetDataString now, but now the problem is 'getDataString' (a nil value), which still makes no sense at all.

It should ALWAYS return a value.. hmm
 
Back
Top