Best-Killer Posted December 20, 2016 Share Posted December 20, 2016 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 Link to comment
Best-Killer Posted December 20, 2016 Author Share Posted December 20, 2016 any help pls ?? comon ?? Link to comment
pa3ck Posted December 20, 2016 Share Posted December 20, 2016 (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 December 20, 2016 by pa3ck Link to comment
Best-Killer Posted December 20, 2016 Author Share Posted December 20, 2016 i'm trying to get user name account from his ID account Link to comment
Best-Killer Posted December 20, 2016 Author Share Posted December 20, 2016 ah i got you thx i got it fixed i'm using getRealTime().timestamp to add vip how to make function to check if that player vip finished ?? what i have to use ?? Link to comment
pa3ck Posted December 21, 2016 Share Posted December 21, 2016 You can compare the 2 timestamps just like you would compare 2 numbers. if bannedAt > getRealTime().timestamp then -- still banned end Link to comment
Best-Killer Posted December 21, 2016 Author Share Posted December 21, 2016 ok thx i'll try Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now