Jump to content

Karuzo

Members
  • Posts

    1,213
  • Joined

  • Last visited

Everything posted by Karuzo

  1. 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?
  2. Could you explain to me what this [1].id means ?
  3. Karuzo

    i want code

    Why don't you use Wei's code? That's all you need.
  4. Karuzo

    i want code

    and takePlayerMoney() //Edit: Too Late D:
  5. 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 .... ?
  6. Karuzo

    -- Code --

    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)
  7. Oh thank you, didn't noticed that. Could you help me with the other problem too ?
  8. 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 )
  9. @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.
  10. Karuzo

    Cars

    Red color would be 125,0,0 or 255,0,0,
  11. Karuzo

    Logging in

    Ok, thank you (:
  12. Karuzo

    Logging in

    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
  13. Karuzo

    Logging in

    Ah ok, now i understand it. Thank you
  14. Karuzo

    Logging in

    Thank you! Works perfectly. How can i read out the passwords if they were encrypted ?
  15. Karuzo

    Logging in

    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)
  16. Karuzo

    Cars

    lol. Try to type in the Console debugscript 3 as Administrator. And than tell us what it says please.
  17. Karuzo

    Cars

    No. You could say what's the error at least.
  18. Karuzo

    Logging in

    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)
  19. Karuzo

    Logging in

    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 ?
  20. Karuzo

    Logging in

    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.
  21. Karuzo

    Chat Problem

    use source if it is server-side.
  22. You should check this : https://wiki.multitheftauto.com/wiki/Scr ... troduction 'Cause your code doesn't really makes sense.
  23. They were not position coordinates.
×
×
  • Create New...