Agressivelol Posted October 26, 2010 Share Posted October 26, 2010 Hi function ach1() local players = getElementsByType ( "player" ) -- get a table of all the players in the server for k,v in ipairs(players) do local serial = getPlayerSerial(v) local yx = executeSQLSelect ( "Mysqltable", "yx","serial = '" .. serial .. "'") if yx == 1 then outputChatBox ( "1", getRootElement(), 255, 0, 0, true ) elseif yx == 0 then outputChatBox ( "0", getRootElement(), 255, 0, 0, true ) else local pn = getPlayerName(v) outputChatBox ( "#ffff00**"..pn.."#ffff00 else", getRootElement(), 255, 0, 0, true ) triggerClientEvent ( "onGreeting", getRootElement(), "Hello World!" ) end end end its rude but how to get it work like yx is sql value and how to check it ? like if xy == 1 then blabla but it isnt working atM sorry for terrible english -.- need sleep Link to comment
dzek (varez) Posted October 26, 2010 Share Posted October 26, 2010 local result = executeSQLSelect ( "Mysqltable", "yx","serial = '" .. serial .. "'") if ( type( result ) == "table" and #result == 0 ) or not result then -- there is no such rows, or sql execution failed else if result[1]["yx"] == 1 then -- first row (1), column called "yx" (as you can select multiple columns on one query) -- and i'm not sure if it will return integer number or string on select - maybe you have to write == "1" end end edit: wiki is your friend Link to comment
Agressivelol Posted October 26, 2010 Author Share Posted October 26, 2010 if result[1]["yx"] == 1 then thanks, working Link to comment
dzek (varez) Posted October 26, 2010 Share Posted October 26, 2010 The Order For Person-correctly-using-quote-feature is going to you, Agressivelol, congratulations! Really, I'm impressed If you don't get my message - simply ignore it ^^ 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