Jimmy.
-
Posts
21 -
Joined
-
Last visited
Posts posted by Jimmy.
-
-
Thx
-
UPDATED CODE
-
Server:
function Video ( player, commandName, text) triggerClientEvent(getRootElement(),"createVideo", getRootElement(), text) end addCommandHandler ( "startas", Video )
Client:
local screenWidth, screenHeight = guiGetScreenSize() local webBrowser = createBrowser(screenWidth, screenHeight, false, false) addEvent ("createVideo", true) addEventHandler ("createVideo", getRootElement(), function (text) local x, y = 110.7, 1024.15 dxDrawMaterialLine3D(x, y, 23.25, x, y, 14.75, webBrowser, 18.2, tocolor(255, 255, 255, 255), x, y+1, 19) loadBrowserURL(webBrowser, ""..text.."") end )
Sounds work, but video no.
Debug show nothing.
-
Thanks.
-
How to check or in guiCreateEdit is dot symbol. I tried:
if string.find(register_email, ".") then else triggerClientEvent(client,"SetWarningMessage",client,"Register","Dot not found.") return end
but not working.
-
PROBLEM SOLVED.
-
-
Maybe. Output username and then compare to the row in the table.
function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=?", username) outputChatBox(username) local result = dbPoll( query, -1 ) outputChatBox(#result) if #result == 1 then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=? AND password=?",username,password) local result = dbPoll( query, -1 ) if #result == 1 then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler)
outputChatBox(username) here it is okay, what i wrote, output show the same.
I send PM my all clientside file.
-
It's wrong username. What username did you enter exactly?
The same "0". Maybe something can be wrong with clientside?
-
outputChatBox shows "0"
-
Again always "Wrong username".
-
dbPoll doesn't return boolean value.
function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=?", username) local result = dbPoll( query, -1 ) if result then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=? AND password=?",username,password) local result = dbPoll( query, -1 ) if result then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler)
But now always show: "Welcome to My Server." Or wrong username or no.
-
I check or row is exist, but always got " Wrong username" even username is in database. Where can be a mistake?
function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=?", username) local result = dbPoll( query, -1 ) if result == true then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=? AND password=?",username,password) local result = dbPoll( query, -1 ) if result then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler)
-
dbQuery's documentation on the wiki; Returns a query handle unless the connection is incorrect, in which case it return false.
You're only checking if you got something, which is true. You got a query handle, therefore all your accounts 'known'. You should use DbPoll to see if you actually got a row returned.
Thanks.
-
An easy way to achieve what you wanted is this.
local HOST = "localhost" local USERNAME = "root" local PASSWORD = "" local DATABASE = "mta" local connection = false function getConnection() return connection end function connect() connection = dbConnect("mysql","dbname="..DATABASE..";host="..HOST..";",USERNAME,PASSWORD) end addEventHandler("onResourceStart",resourceRoot,connect)
Just add an export for the getConnection, and change the first line of the other code to
local handler = exports.SQL:getConnection()
Thanks, it works, but I have another mistake. Whatever username or password write always fit. Where to look for errors?
-
Hello, what's wrong with this code? How to make, that doesn't show error about SQL nil? http://prntscr.com/7s2rbp.
local handler = exports.SQL:connect() function loginHandler(usernametext,passwordtext) local query = dbQuery(handler,"SELECT * FROM accounts WHERE Username=?", usernametext) if (query) then local query = dbQuery(handler,"SELECT * FROM accounts WHERE Username=? AND Password=?",usernametext,passwordtext) if (query) then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("submitLoginStepTwo",true) addEventHandler("submitLoginStepTwo",root,loginHandler)
local HOST = "localhost" local USERNAME = "root" local PASSWORD = "" local DATABASE = "mta" local connection = false function connect() connection = dbConnect("mysql","dbname="..DATABASE..";host="..HOST..";",USERNAME,PASSWORD) end addEventHandler("onResourceStart",resourceRoot,connect)
-
-
Hi,
how can I change guiCreateEdit box color or add picture on it?
Not Possible
Or use by dx....
visit this link:
https://forum.multitheftauto.com/viewtopic.php?f=108&t=84376
Thanks.
-
Hi,
how can I change guiCreateEdit box color or add picture on it?
CEF
in Scripting
Posted
Hi,
What are the main reasons why lags videos? How can reduce lagging? Lag is significantly lower when using YouTube, but I can't upload film in Youtube. Maybe you know what video storage web which does not prevent it? And is it possible to make management with cursor when browser I use on dxDrawMaterialLine3D?
Thanks.