Marald Posted August 14, 2022 Share Posted August 14, 2022 Bad argument @ 'getPlayerAccount' [Expected element at argument 1,got boolean] Bad argument @ 'getAccountName' [Expected element at argument 1,got boolean] my code: db = dbConnect( "sqlite", "db.db" ) function checkFraction(player) local acc = getPlayerAccount(player) local playerName = getAccountName(acc) local result = dbPoll(dbQuery(db,"SELECT * FROM `fraction` WHERE login = ?",playerName),-1) if #result > 0 then for i,v in ipairs(result) do outputChatBox('This fraction : '..v.fractionId,player) end else outputChatBox("Error",player) end end checkFraction() please help me Link to comment
fxl Posted August 14, 2022 Share Posted August 14, 2022 (edited) db = dbConnect( "sqlite", "db.db" ) function checkFraction(player) local acc = getPlayerAccount(player) local playerName = getAccountName(acc) local result = dbPoll(dbQuery(db,"SELECT * FROM `fraction` WHERE login = ?",playerName),-1) if #result > 0 then for i,v in ipairs(result) do outputChatBox('This fraction : '..v.fractionId,player) end else outputChatBox("Error",player) end end checkFraction() -- you need to add player argument for example for _,plrs in ipairs(getElementsByType("player")) do -- get all players on server checkFraction(plrs) --check their fraction end Edited August 14, 2022 by fxl 1 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