Jump to content

vip database


Best-Killer

Recommended Posts

Posted
function test (player,cmd)
acc = getAccountName(getPlayerAccount(player))
if isPlayerVIP(acc) then
outputChatBox("Vip level"..tostring(isPlayerVIP(getAccountName(getPlayerAccount(player)))))
else
outputChatBox("error")
end
end
addCommandHandler("aa",test)
function isPlayerVIP(accountName)
	local check = exports.NGsql:db_query ( "SELECT * FROM vips_data WHERE acc=? ", getIDAccount(accountName))
	if ( type( check ) == "table" and #check == 0 ) or not check then
		return false
	else
		return check[1]["level"]
	end
end
function getIDAccount(player)
	plid = false
	pqr = exports.NGsql:db_query ( "SELECT * FROM accountdata WHERE id=? LIMIT 1", tonumber(player))
	for k, plas in ipairs (pqr) do
		plid = plas["Username"]
	end
	if not plid then return false end
	return plid
end

i'm geting in chat error -_-

i'm sure the accountid is in database and vip level .... ect

no errors what's worng guys

Posted (edited)

tonumber(player) -- what do you expect? If you tonumber the username of the account, it's gonna give you the user id?

When you are passing the variable "player", you are not sending a number but a username.

Edited by pa3ck
Posted

You can compare the 2 timestamps just like you would compare 2 numbers.

if bannedAt > getRealTime().timestamp then
  -- still banned
end

 

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