-
Posts
642 -
Joined
-
Last visited
Everything posted by Lloyd Logan
-
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)
-
Hi, just as the title says, a quick question! If I'm showing the dxDrawText, how do i hide it? Lloyd
-
I'll try that! Is dbExec ( server, "UPDATE accounts SET money = ? WHERE serial = ?", moneys, firstserial ) All you changed?
-
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 dbQuery ( server, "INSERT INTO accounts (serial, money) VALUES (?, ?)", tostring (firstserial), tostring (moneys) ) end end addEventHandler( "onPlayerQuit", root, submitReg )
-
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 (?, ?)", tostring (theserial), tostring (themoney) ) end end addEventHandler( "onPlayerQuit", root, submitReg ) exports.scoreboard:addScoreboardColumn("Money") function setMoney() local Serial = getPlayerSerial(source) local data = dbPoll(dbQuery(server, "SELECT money FROM accounts WHERE serial = ?", Serial), -1) if data and type(data) == "table" then setPlayerMoney(source, data[1]["money"]) setElementData(source, "Money", data[1]["money"]) else outputChatBox("You have not previously logged in!", getRootElement(), 255, 0, 0) end end addEventHandler("onPlayerJoin", root, setMoney)Why does this save the serial as nil and money as 0?
-
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
-
Thank you!! One more question, does the data[1]["money"]) [1] just mean to unfreeze the dbPoll?
-
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"
-
LED display. View from camera in real time on e.g. billboard
Lloyd Logan replied to polakg1140's topic in Scripting
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) -
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
-
So how would i setPlayerMoney when retrieving this information? local playermoney = dbQuery ( server, "SELECT 'money' FROM 'accounts' WHERE serial = '"..serial.."' " )
-
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?
-
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?
-
I used SELECT, but how would i select something from a specific row?
-
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.
-
So how would I use this in terms of setPlayerMoney(something.somthing?) Thanks also!
-
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 setElementPosition ( source, row.x, row.y, row.z) except for dbQuery Thanks!
-
Thanks guys, I'll try both when I'm free and get back to you all!
-
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 INTO accounts (accountname, password) VALUES (?,?)", inputusernamereg, inputpasswordreg) output = outputChatBox("You have successfully created an account!") triggerClientEvent("closedok", getRootElement()) triggerClientEvent("onclose", getRootElement()) end
-
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!
-
Any errors from console/chat?
-
You type in the chat box /bind b flashlight After this, when you click "b" the flashlight will turn on and off
-
Do you mean; INGAME /bind flashlight Is that what you mean?
