
Karuzo
Members-
Posts
1,213 -
Joined
-
Last visited
Everything posted by Karuzo
-
Oh now i understand. So local checkcar = dbQuery(connection, "SELECT * FROM car WHERE id IS NOT NULL") if #checkcar ~= 0 then end Will check if the column is empty , right?
-
Could you explain to me what this [1].id means ?
-
Wow! Looks really nice! Good luck.
-
Why don't you use Wei's code? That's all you need.
-
and takePlayerMoney() //Edit: Too Late D:
-
And how do i ask , if the column is null ? Like : local checkcar = dbQuery(connection, "SELECT * FROM car WHERE id IS NOT NULL") if checkcar == nil then .... ?
-
Server-Side. Otherwise he couldn't get it in the created Vehicle(in Client-Side.) btw, why do you get the ElementPosition ? If he gets in the marker hes in the Marker right ? so the position is the on of the Marker. local marker1 = createMarker (x,y,z ) addEventHandler("onMarkerHit",marker1,function (hitElement) local x, y, z = getElementPosition (marker1) local car = createVehicle ( 432, x, y, z + 10 ) warpPedIntoVehicle(hitElement,car) outputChatBox ( "You got a Car'!",hitElement,0,255,0) end)
-
Oh thank you, didn't noticed that. Could you help me with the other problem too ?
-
Hey Guys, so i have a question about sql again. How can i check that a data exists already in the databse ? For example. To check if the player has bought already a car. Hope you understood me. My Code: local connection local vehicle function vehicleCreat( player, preis,vId) local account = getAccountName(getPlayerAccount(player)) connection = dbConnect( "sqlite", "cars.db", "", "", "share=0" ) local playerm = string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '' ) if connection then local query = dbQuery ( connection , "CREATE TABLE IF NOT EXISTS car (id NUMERIC, owner TEXT, name TEXT, health NUMBERIC, paintjob NUMERIC, color NUMERIC, upgrades NUMERIC)" ) if query then if getPlayerMoney ( player ) >= math.abs(preis) then local vName = getVehicleNameFromModel ( vId ) local query = dbExec ( connection, "INSERT INTO car(id,owner,name,health,paintjob,color,upgrades) VALUES(?,?,?,?,?,?,?)", vId, tostring(account), tostring(vName), 1000, 0, 0, 0) outputDebugString("query successfull") vehicle = createVehicle ( vId, 545.33130, -1257.61816, 16.62232, 0, 0, -45 ) warpPedIntoVehicle(player, vehicle) takePlayerMoney ( player, math.abs(preis) ) setElementData(player, "CarGot", "no") outputChatBox("Du hast dir erfolgreich ein " .. vName.. " gekauft!", player, 0, 125, 0, false) else outputChatBox("Du kannst dir dieses Auto nicht leisten!",player, 125, 0, 0, false) end else outputDebugString("Datenbank-Verbindung(CARSYS) konnte nicht hergestellt werden!") end end end addEvent( "CarBuy", true ) addEventHandler( "CarBuy", root, vehicleCreat )
-
@Anubhav: He wants that every car which will be exploded will be destroyed. And that would do WhoAmI's code. Your code would only destroy the car which he creates.
-
Hahaha, sorry but were you drunk when you made this ? Haha that could be. No, just the first time i'm using sql functions. But thank you for your reply, now it's more clear
-
Ah ok, now i understand it. Thank you
-
Thank you! Works perfectly. How can i read out the passwords if they were encrypted ?
-
Oh thank you , didn't knew that. And what about the SELECT Query ? I want to get the username and the password to compare it with the acc. function login_func ( player, username, password) local acc = dbQuery(connect, "SELECT username password FROM accounts") if (username and password) == acc then setElementData(player, "LoggedIN",true) outputChatBox("Du hast dich erfolgreich eingeloggt!",player,0,125,0) outputChatBox("Willkommen zurück, "..string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '' ),player,0,125,0) triggerClientEvent(player,"closeLoginPanel",player) else outputChatBox("Error 404 : Dein Benutzername oder dein Passwort ist falsch!",player,125,0,0) end end addEvent("LoginRequest",true) addEventHandler("LoginRequest",getRootElement(),login_func)
-
lol. Try to type in the Console debugscript 3 as Administrator. And than tell us what it says please.
-
No. You could say what's the error at least.
-
Why doesn't this work ? It just doesn't put the username and the password in the columns. function register_func ( player, username, password) local acc = dbQuery(connect,"INSERT INTO accounts(name, password) VALUES (username, password)") local acce = getAccount(username) if acc then setElementData(player, "Registered",true) outputChatBox("Du hast dich erfolgreich registriert! Name: " .. username.. " Passwort: " ..password,player,0,125,0) triggerClientEvent(player,"closeLoginPanel",player) else outputChatBox("Error 404: Benachrichtige den Administrator!!!",player,125,0,0) end end addEvent("RegRequest",true) addEventHandler("RegRequest",getRootElement(),register_func)
-
So lets say, he clicks on Login, i Select from the table his Name&Password, and if they were right, i give him a element data ? And How do i check if a username/password already exists ?
-
Hey Guys, i have a few questions about SQLite and Logging in. So lets say i have created a accounts table with dbQuery. And want to insert the password and the username the player entered. ok so i did that. But what can i do after that ? So i know that the player is Logged in. I don't want to use the logIn function. How can i check if he is logged in. With Element Datas ? Thank you for your coming help.
-
You should check this : https://wiki.multitheftauto.com/wiki/Scr ... troduction 'Cause your code doesn't really makes sense.
-
They were not position coordinates.