-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
function sqlQuery(query, ...) iprint(connection, query, ...) -- < iprint here return dbQuery(connection, query, ...) end -- do the original query function, if something goes wrong then it is not a problem with your utility function. local qh = dbQuery(connection, "INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1 original", "asd2 original") dbFree ( qh ) -- do yours. local Query = sqlQuery ("INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1", "asd2") dbFree ( Query ) if Query then outputServerLog ("true") else outputServerLog ("false") end
-
Yes there, that is correct. Values are looking correct. Did you test it with the default function? And did that work? And please post more of the updated code.
-
test it first with the default function. If that is OK. Then debug the arguments. iprint(connection, query, ...)
-
_dbQuery = dbQuery function dbQuery(query, ...) return _dbQuery(connection, query, ...) end Basis from quindo. If you want to fill in multiple values.
-
Lets start with the basics example -- < this is a variable thisPlayer -- < this too hi -- < and this, etc. First of all, variables CAN CONTAIN any value. The name does not define what value it contains, unless it is predefined. So the variable thePlayer does not have to contain a player value. It can be anything, it is just a name where you can assign a value to. example = "nice" -- it can contain a string example = false -- or a boolean example = 12345 -- or a number example = {} -- a table -- and more! Here you have a list with predefined variables: This is the list of the predefined variables from MTA(written down by Kenix) Those variables contain the values that are declared before your script is loaded. Yet some of them do only contain values under special conditions. You can find those conditions in the comments behind the variables. SO PLEASE, there is NO thePlayer. It does not exist by itself. Now to get back to your issue. There is a predefined variable localPlayer, please check the list again. It is YOU and your adorable ped element. (clientside only) If we visit this page: https://wiki.multitheftauto.com/wiki/TriggerServerEvent You can see the required arguments: Required Arguments event: The name of the event to trigger server-side. You should register this event with addEvent and add at least one event handler using addEventHandler. theElement: The element that is the source of the event. The event: "takeCash" And the source element: resourceRoot The source element is a predefined variable, which will be come active after triggering an addEventHandler. function takeCashHandler ( thePlayer, amount ) iprint(source) -- resourceRoot end `source` is NOT a parameter. Parameters are the variables that be found here: takeCashHandler (<parameter>, <AND parameter>, <ETC.>) The special thing about parameters is that they contain the values that are given from the place where the function is called from. (see example below) For the ones that are using the `source` as parameter, they are not consistent and will confuse other people if they share their code. Using source as parameter will overwrite it's value if already set. If I call your function with a normal call, it would looks like this: function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end local randomPlayer = getRandomPlayer() takeCashHandler (randomPlayer , 2 ) -- calling the function takeCashHandler The first parameter receives the first value <just a random player in the server>. The second parameter receives the second number value 2. Order matters, name does NOT! In this code we give two parameters a value. The value of the predefined variable `localPlayer` and a number value 2. -- Client side triggerServerEvent ( "takeCash", resourceRoot, localPlayer, 2 ) -- takes $2 of the player -- Server side function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end addEvent( "takeCash", true ) addEventHandler( "takeCash", resourceRoot, takeCashHandler ) There is also the predefined variable `client` which you could use. Which represents the player (element) that has called the server. But only is defined when an addEventHandler exist and has been used.
-
Serverside is running on the 'server' computer and clientside is running on the pc you use to play mta. If you use a local server. They both run on the same computer but in a different environment. Summary Serverside = server computer (or on your game pc in a different environment) Clientside = game pc They play their own roll and have to communicate between each other, in order to move information from one computer to another. The rest speaks for itself.
-
executeSQLQuery("CREATE TABLE IF NOT EXISTS `users` (username TEXT, password TEXT)") https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery This will create a table `users` if it doesn't exist already.
-
The texture(image) has failed to load. Please post parts of the script and check if: screenshot (upload) / screen capture is enabled. (the script might be using that feature) You can find that option in your MTA settings menu.
-
He puts everything through Google translate, to hell Google translate does that for him. Or the word 'guy' is his country must mean the same as 'gay', which I seriously doubt. @santinet12 There are a lot of examples of how to use the bindkey functions in here: https://wiki.multitheftauto.com/wiki/BindKey Why don't you start with applying and modifying example 1 in to your code?
-
You should have asked that question in your main post lol. Please take a look at the example of this function, it just what you need: https://wiki.multitheftauto.com/wiki/IsTransferBoxActive
-
Only one of them is in use, the other one is just faked, by attaching the weapon object to the ped his hand. Check this resource and it's example: https://community.multitheftauto.com/index.php?p=resources&s=details&id=2540
-
addEventHandler("onPlayerJoin", root, function () -- he joins the server end) addEventHandler("onPlayerWasted", root, function () -- So sorry, please die again end) https://wiki.multitheftauto.com/wiki/SpawnPlayer @TorNix~|nR time to make your first attempt.
-
Just add two new ones, for serverside and clientside. Or more if you want per functionality a file.
-
Nice concepts, now please start coding your first attempts.
-
Why don't you start with making the component to retrieve the upgrades first?
-
How can we help you if we aren't allow to edit the code? The information is badly translated, I can't understand anything of it. Don't be a racist. It is really NOT OK to post racist content inside your code.
-
AVG fps. AVG ping. Travel distance. Screenshots taken.
-
You tell me, where is the serverside file?
-
OH lol, waaaaaahhh!! This is NO good, hell no. =/ local newLvl = false function newLvlFunction() if not newLvl then setTimer(function() newLvl = false end,5000,1) end newLvl = true end addEvent( "onClientLevelUp", true ) addEventHandler( "onClientLevelUp", localPlayer, newLvlFunction) addEventHandler("onClientRender", root, function () if newLvl == true then dxDrawRectangle(screenW * 0.4083, screenH * 0.9037, screenW * 0.1839, screenH * 0.0528, tocolor(0, 0, 0, 160), false) dxDrawImage(screenW * 0.4094, screenH * 0.9046, screenW * 0.0271, screenH * 0.0491, ":DayZ/tools/images/flags/join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Congradulations! You have reached "..getElementData(getLocalPlayer(),"level").." Level!", screenW * 0.4385, screenH * 0.9046, screenW * 0.5901, screenH * 0.9537, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) end end) @Emix
-
A little bit dirty, but this might work: local newLvl = false function newLvl() newLvl = true end addEvent( "onClientLevelUp", true ) addEventHandler( "onClientLevelUp", localPlayer, newLvl) addEventHandler("onClientRender", root, function () if newLvl == true then dxDrawRectangle(screenW * 0.4083, screenH * 0.9037, screenW * 0.1839, screenH * 0.0528, tocolor(0, 0, 0, 160), false) dxDrawImage(screenW * 0.4094, screenH * 0.9046, screenW * 0.0271, screenH * 0.0491, ":DayZ/tools/images/flags/join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Congradulations! You have reached "..getElementData(getLocalPlayer(),"level").." Level!", screenW * 0.4385, screenH * 0.9046, screenW * 0.5901, screenH * 0.9537, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) setTimer(function() newLvl = false end,5000,1) end end)
-
The event you cancelled has no relationship with changing the skin, so that will not work. Use, over cancelEvent(). setElementModel( source, 0 ) And this part is incorrect: function tt() triggerServerEvent( "setplayermask", localPlayer, "zombie") if getElementModel( source ) == 308 then cancelEvent() end end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), tt)
-
Is(And to which skin afterwards?) OR on skin changed? Your code doesn't make sense and should be serverside to prevent de-sync.
-
guiSetText(GUIEditor.edit[1], tostring(loadSavedData("username", "") or "")) guiSetText(GUIEditor.edit[2], tostring(loadSavedData("password", "") or ""))
-
Want to learn some more? Did you ever tried to remove multiple items from a table using table.remove? If not, try it and see what happens. I will provide you with a solution to an issue you will encounter. Give it 10 items and remove 3 or more of them with your own conditions. Make sure that atleast two items are placed next to each other. Debug the table at the end. iprint(table)
-
If you convert them to textures. https://wiki.multitheftauto.com/wiki/DxCreateTexture And if you enable mipmaps, they are pretty good. Mipmaps will create multiple versions of the image of different scales. But remember, images ARE NOT vector files and SVG is not supported in mta.
