Aboodealtikrity Posted September 28, 2016 Share Posted September 28, 2016 Hello Guys look to this ~~server~~ function getinfo() local result = mysql_query(handler, "SELECT * FROM account WHERE mtaserial='"..getPlayerSerial(source).."'") numRows = mysql_num_rows ( result ) if numRows == 1 then if (result) then while true do local data = mysql_fetch_assoc(result) if (not data) then break end name1 = tostring(data["email"]) name2 = tostring(data["surname"]) triggerClientEvent(source, "selectt", getRootElement(), name1, name2) end mysql_free_result(result) else end end end ~~client~~ function show (namee) if ( ( source == playerstable ) ) then if ( guiGridListGetSelectedItem( playerstable ) ~= -1 ) then guiSetText ( accountnamelabel, "AccountName : "..namee.."" ) end end end addEvent("selectt",true) addEventHandler("selectt",getRootElement(),show) The problem is When im pressing on Playername instead of accountname its showing Word "left" this Screenshot thanks Link to comment
dugasz1 Posted September 28, 2016 Share Posted September 28, 2016 (edited) Somewhy the value of your email field is left. You triggerd the email and surname in this order(... name1, name2), so on your client the show function will be called with this arguments with the same order. Edited September 28, 2016 by dugasz1 Link to comment
Aboodealtikrity Posted September 29, 2016 Author Share Posted September 29, 2016 13 hours ago, dugasz1 said: Somewhy the value of your email field is left. You triggerd the email and surname in this order(... name1, name2), so on your client the show function will be called with this arguments with the same order. i tried to change it but it still left i tried accountname or tonumber like ip the same left can you give me a small example for that and thanks for help Link to comment
dugasz1 Posted September 29, 2016 Share Posted September 29, 2016 ~~server~~ function getinfo() local result = mysql_query(handler, "SELECT * FROM account WHERE mtaserial='"..getPlayerSerial(source).."'") numRows = mysql_num_rows ( result ) if numRows == 1 then if (result) then while true do local data = mysql_fetch_assoc(result) if (not data) then break end email = tostring(data["email"]) --Dunno why you need the email but i trigged it to the client tooo surname = tostring(data["surname"]) outputChatBox( "Surname: ".. surname ) --Check what is in your database what we sand to the client triggerClientEvent(source, "selectt", getRootElement(), email, surname) end mysql_free_result(result) else end end end ~~client~~ function show (email, surname) if ( ( source == playerstable ) ) then if ( guiGridListGetSelectedItem( playerstable ) ~= -1 ) then guiSetText ( accountnamelabel, "AccountName : "..surname.."" ) end end end addEvent("selectt",true) addEventHandler("selectt",getRootElement(),show) I don't know how your database looks like. PS.: sql modele is not recommended to use rather use MTA SQL_functions Link to comment
Aboodealtikrity Posted September 30, 2016 Author Share Posted September 30, 2016 8 hours ago, dugasz1 said: ~~server~~ function getinfo() local result = mysql_query(handler, "SELECT * FROM account WHERE mtaserial='"..getPlayerSerial(source).."'") numRows = mysql_num_rows ( result ) if numRows == 1 then if (result) then while true do local data = mysql_fetch_assoc(result) if (not data) then break end email = tostring(data["email"]) --Dunno why you need the email but i trigged it to the client tooo surname = tostring(data["surname"]) outputChatBox( "Surname: ".. surname ) --Check what is in your database what we sand to the client triggerClientEvent(source, "selectt", getRootElement(), email, surname) end mysql_free_result(result) else end end end ~~client~~ function show (email, surname) if ( ( source == playerstable ) ) then if ( guiGridListGetSelectedItem( playerstable ) ~= -1 ) then guiSetText ( accountnamelabel, "AccountName : "..surname.."" ) end end end addEvent("selectt",true) addEventHandler("selectt",getRootElement(),show) I don't know how your database looks like. PS.: sql modele is not recommended to use rather use MTA SQL_functions I've wrote email and surname for checking because it showing the value is "left" so the orginial trigger was accountname thanks i will try this ... 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