function loginHandler(username,password) -- client/gui.login.lua ------ WALIDACJA LOGOWANIA
-- SPRAWDZAMY CZY ISTNIEJE
local query = dbQuery(db, "SELECT `uid`,`nick`,`skin`,`pieniadze` FROM `"..MYSQL_PLAYERS.."` WHERE `nick`=? AND `haslo`=?",username,password)
local result, rows = dbPoll(query,-1)
if rows~= 0 then
for i,row in ipairs (result) do
if (client) then
setPlayerName(client,row["nick"])
setElementModel(client,row["skin"])
setPlayerMoney(client,row["pieniadze"],true)
spawnPlayer(client, 1959.55, -1714.46, 10)
fadeCamera(client, true)
setCameraTarget(client, client)
outputChatBox("Witaj ponownie "..getPlayerName(client)..". Udanej zabawy!", client,0,125,255)
end
end
elseif result==nil then
dbFree(query)
else
outputChatBox("Niepoprawny login lub has?o. Po??cz si? ponownie.",client,255,0,0)
end
end
addEvent("submitLogin",true)
addEventHandler("submitLogin",root,loginHandler)