Jump to content

Always returns true


gyrosos14

Recommended Posts

function isPlayerBanned(player)
	if (player) then
		local serial = getPlayerSerial(player);
		local qh = dbQuery(con, "SELECT * FROM bans WHERE serial=? AND expiration > CURRENT_TIME()", serial); 
		local bans = dbPoll(qh, 500);
		if (bans) then
			if (#bans > 0) then 
				return true; 
			else 
				return false;
			end
		else
			return false;
		end
	else
		return false;
	end
end

The script always gives me true, even if i replace that one true with false

Link to comment

Hey,

It doesn't make sense to always return true even as you said when you replace the true with false.
Could you show the part where you check what the function returns.

Also there is no need of all those elses.

function isPlayerBanned(player)
	if (player) then
		local serial = getPlayerSerial(player);
		local qh = dbQuery(con, "SELECT * FROM bans WHERE serial=? AND expiration > CURRENT_TIME()", serial); 
		local bans = dbPoll(qh, 500);
		if (bans) then
			if (#bans > 0) then 
				return true; 
			end 
		end
	end
	return false;
end

 

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...