Jump to content

Lloyd Logan

Members
  • Content Count

    642
  • Joined

  • Last visited

Everything posted by Lloyd Logan

  1. Why doesn't this set the matrix of the camera? (CLIENT) function cmatrix() setCameraMatrix(2056.1774902344,1181.1239013672,56.897701263428,2057.064453125,1180.6881103516,56.744400024414,0,70) end addEventHandler("onClientPlayerJoin", cmatrix)
  2. Hi, just as the title says, a quick question! If I'm showing the dxDrawText, how do i hide it? Lloyd
  3. I'll try that! Is dbExec ( server, "UPDATE accounts SET money = ? WHERE serial = ?", moneys, firstserial ) All you changed?
  4. Sorry there was some blatant mistakes in that code! I'm now able to save the money when the player quits, and load it when they join, so now I am stuck on how to update it if their info is already in the table! function submitReg() firstserial = getPlayerSerial(source) moneys = getPlayerMoney(source) local data = dbPoll(dbQuery(server, "SELECT money FROM accounts WHERE serial = ?", firstserial), -1) if data and type (data) == "table" and #data > 0 then dbExec( server, "UPDATE accounts SET money=`"..moneys.."` WHERE serial = '"..firstserial.."'" ) else
  5. server = dbConnect ( "mysql", "dbname=servermta;host=127.0.0.1","root") dbExec(server, "CREATE TABLE IF NOT EXISTS accounts (serial TEXT NOT NULL, money INT NOT NULL)") function submitReg() firstserial = getPlayerSerial(source) moneys = getPlayerMoney(source) local data = dbPoll(dbQuery(server, "SELECT money FROM accounts WHERE serial = ?", firstserial), -1) if data and type (data) == "table" and #data > 0 then dbExec( server, "UPDATE `accounts` SET `money`=`"..moneys.."`" ) else dbQuery ( server, "INSERT INTO accounts (serial, money) VALUES (?, ?)"
  6. Oh Thanks, but what happens now is, everytime the player joins, a new row is created instead of checking for previous log ins and updating them! So far is this checkforserial = dbQuery (server, "ALTER TABLE accounts, ADD CHECK ('"..theserial.."'>0)") if (checkforserial == false) then dbQuery ( server, "INSERT INTO accounts (serial, money) VALUES (?, ?)", tostring (theserial), tostring (themoney) ) else
  7. Thank you!! One more question, does the data[1]["money"]) [1] just mean to unfreeze the dbPoll?
  8. That's my code function setMoney() serial = getPlayerSerial(source) local data = dbPoll(dbQuery(server, "SELECT 'money' FROM 'accounts' WHERE serial = '"..serial.."' "), -1) setPlayerMoney(player, data[1]["money"]) if data then local curmoney = getPlayerMoney(source) exports.scoreboard:addScoreboardColumn("Money") setElementData(thePlayer,"Money",curmoney,true) end end addEventHandler("onPlayerJoin", root, setMoney) It gives the error; attempt to index local 'data' "a boolean value"
  9. You should first get the position of the billboard. Then setCameraTarget, I do not know what you mean by the second point, but I think you me so it happens realistically, if that's what you mean, then it should already do it after setCameraTarget (Remember, to be able to set Camera target as x, y ,z it must be Client Side)
  10. So how would i setPlayerMoney when retrieving this information? local playermoney = dbQuery ( server, "SELECT 'money' FROM 'accounts' WHERE serial = '"..serial.."' " ) I honestly don't understand at all, surely once I retrieved the info from the money index local playermoney = dbQuery ( server, "SELECT 'money' FROM 'accounts' WHERE serial = '"..serial.."' " ) I can simply apply it to setPlayerMoney
  11. So how would i setPlayerMoney when retrieving this information? local playermoney = dbQuery ( server, "SELECT 'money' FROM 'accounts' WHERE serial = '"..serial.."' " )
  12. I'll try again, if not i'll post my code I have multiple rows in mySQL such as money position etc But how do I select money from a specific say, account name or serial?
  13. I'll try again, if not i'll post my code I have multiple rows in mySQL such as money position etc But how do I select money from a specific say, account name or serial?
  14. I used SELECT, but how would i select something from a specific row?
  15. I'm totally stuck, i'm only trying to get some values from mySQL, maybe i'm going about it wrong? I stored it in mySQL, now i'm trying to take a certain value (money ) out.
  16. So how would I use this in terms of setPlayerMoney(something.somthing?) Thanks also!
  17. Lloyd Logan

    MySQL

    I was looking at someones script and saw this; local result = mysql_query ( database ,"SELECT * FROM `accounts` WHERE `serial` = '"..serial.."'") if result then while true do local row = mysql_fetch_assoc(result) if not row then break end setElementPosition ( source, row.x, row.y, row.z) So in order for him to use row.blah blah, he used mysql_query then local row = mysql_fetch_assoc My problem is, i'm using dbQuery, so how would i create one equal to local row = mysql_fetch_assoc(result) if not row then break end
  18. Thanks guys, I'll try both when I'm free and get back to you all!
  19. Why is this creating an account row and password row, but its putting in blank values e.g. accounts || Password both just equal blank! CLIENT function checkRegField() local inputusernamereg = guiGetText(GUIEditor.edituserreg) local inputpasswordreg = guiGetText(GUIEditor.editpassreg) triggerServerEvent("submitRegister", localPlayer, inputusernamereg, inputpasswordreg) end SERVER function submitReg() dbExec(server, "CREATE TABLE IF NOT EXISTS accounts (accountname TEXT NOT NULL, password TEXT NOT NULL)") new = dbExec(server, "INSERT IN
  20. Try this; function spawnOnDeath () setTimer ( function() spawnPlayer (source, 0, 0, 5) fadeCamera (source, true) setCameraTarget (source, source) end, 5000, 1 ) end addEventHandler("onPlayerWasted", getRootElement(), spawnOnDeath) Though remember, 'play' is the default game mode, so you may have to disable it in order for this to work!
  21. Any errors from console/chat?
  22. You type in the chat box /bind b flashlight After this, when you click "b" the flashlight will turn on and off
  23. Do you mean; INGAME /bind flashlight Is that what you mean?
×
×
  • Create New...