kuba90pl Posted December 22, 2011 Share Posted December 22, 2011 function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT haslo FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) outputChatBox(unpack(dane)) end addEvent("zalogujGracza",true) addEventHandler("zalogujGracza",root,zalogujGracza) mysql table: its show error at outputChatBox . so how to get this value? nazwa is right . Link to comment
kuba90pl Posted December 22, 2011 Author Share Posted December 22, 2011 so if someone didnt understand what i wanted: i just want to get a "haslo" value from a player with specific "nazwa" and i just dont know how Link to comment
Mefisto_PL Posted December 22, 2011 Share Posted December 22, 2011 Napiszę Ci to po polsku bo jesteś polakiem.. Przeczytaj to: https://wiki.multitheftauto.com/wiki/OutputChatBox Masz tu cały opis jak czego użyć. Według mnie to powinieneś podzielić to na kilka grup, a mianowicie np. outputChatBox("Blah Blah"..dane1.." Blah blah", 255, 0, 255, true) Link to comment
kuba90pl Posted December 22, 2011 Author Share Posted December 22, 2011 Napiszę Ci to po polsku bo jesteś polakiem.. Przeczytaj to: https://wiki.multitheftauto.com/wiki/OutputChatBox Masz tu cały opis jak czego użyć. Według mnie to powinieneś podzielić to na kilka grup, a mianowicie np. outputChatBox("Blah Blah"..dane1.." Blah blah", 255, 0, 255, true) lolw. ja to wiem , mi chodzi o to ze problem polega na pobieraniu danych z mysql. eng: i know outputchatbox , but there's problem with getting data from mysql Link to comment
Mefisto_PL Posted December 22, 2011 Share Posted December 22, 2011 no to mówię.. musisz dodać opcję mySQL i podzielić to na grupy tak jak powiedziałem.. zrób najpierw zapisywanie danych w bazie MySQL a potem podziel to na grupy . I say .. you must add the mySQL and divide it into groups of like I said .. make a first write data in the MySQL database and then divide it into groups. Link to comment
kuba90pl Posted December 22, 2011 Author Share Posted December 22, 2011 mi ogolnie chodzi o przyklad jak pobrac dane i odczytac je tak abym mogl je potem uzyc. eng: i just want example how to get data and then use it Link to comment
Castillo Posted December 22, 2011 Share Posted December 22, 2011 (edited) function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT haslo FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) outputChatBox(tostring(dane[1].serial)) end addEvent("zalogujGracza",true) addEventHandler("zalogujGracza",root,zalogujGracza) Edited December 23, 2011 by Guest Link to comment
kuba90pl Posted December 22, 2011 Author Share Posted December 22, 2011 function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT haslo FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) outputChatBox(tostring(dane.serial)) end addEvent("zalogujGracza",true) addEventHandler("zalogujGracza",root,zalogujGracza) function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT * FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) if dane then outputChatBox(tostring(dane.haslo)) end end i wanted to receive "haslo" value not serial , anyway i changed it and it still return nil Link to comment
Castillo Posted December 23, 2011 Share Posted December 23, 2011 function zalogujGracza(nazwa, haslo) local query = dbQuery( funbox_db, "SELECT * FROM gracze WHERE nazwa=?", tostring(nazwa) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if (numrows > 0) then outputChatBox(tostring(result[1].haslo)) end end Link to comment
kuba90pl Posted December 23, 2011 Author Share Posted December 23, 2011 function zalogujGracza(nazwa, haslo) local query = dbQuery( funbox_db, "SELECT * FROM gracze WHERE nazwa=?", tostring(nazwa) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if (numrows > 0) then outputChatBox(tostring(result[1].haslo)) end end BIG BEER FOR YOU ! working , thanks! Link to comment
kuba90pl Posted December 23, 2011 Author Share Posted December 23, 2011 help , this script return true but it doesnt change value in db (haslo) function zarejestrujGracza(nazwa,haslo,email) outputChatBox(nazwa) dbFree(dbQuery ( funbox_db, "UPDATE gracze SET haslo = ? WHERE nazwa = ? " , haslo, nazwa )) outputServerLog("Rejestracja: Gracz "..nazwa.." Haslo: "..haslo.." Email: "..email.."") end addEvent("zarejestrujGracza",true) addEventHandler("zarejestrujGracza",root,zarejestrujGracza) Link to comment
Castillo Posted December 23, 2011 Share Posted December 23, 2011 Try this, not sure (I'm tired): function zarejestrujGracza(nazwa,haslo,email) outputChatBox(tostring(nazwa)) if dbExec( funbox_db, "UPDATE `gracze` SET `haslo` = '" .. haslo .. "' WHERE `nazwa` = '" .. nazwa .."'" ) then outputServerLog("Rejestracja: Gracz "..nazwa.." Haslo: "..haslo.." Email: "..email.."") end end addEvent("zarejestrujGracza",true) addEventHandler("zarejestrujGracza",root,zarejestrujGracza) Link to comment
kuba90pl Posted December 23, 2011 Author Share Posted December 23, 2011 Try this, not sure (I'm tired): function zarejestrujGracza(nazwa,haslo,email) outputChatBox(tostring(nazwa)) if dbExec( funbox_db, "UPDATE `gracze` SET `haslo` = '" .. haslo .. "' WHERE `nazwa` = '" .. nazwa .."'" ) then outputServerLog("Rejestracja: Gracz "..nazwa.." Haslo: "..haslo.." Email: "..email.."") end end addEvent("zarejestrujGracza",true) addEventHandler("zarejestrujGracza",root,zarejestrujGracza) its show in console "rejestracja etc" but in db still in "haslo" value is null 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