-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
setCameraTarget(localPlayer) -- client setCameraTarget(player) -- server
- 1 reply
-
- 1
-
-
Add debug lines! Are you reading none of my comments at all for real? function dxDrawTextOnElem(element, text, height, distance, r, g, b, alpha, size, font) allElems = allElems + 1 triggerClientEvent("dxDraw", resourceRoot, element, text, height or 0, distance or 20, r or 255, g or 0, b or 0, alpha or 255, size or 1, font or "arial", allElems) iprint("did trigger from serverside") end addEventHandler("dxDraw", resourceRoot, function(element, text, height, distance, r, g, b, alpha, size, font, k) iprint("It did trigger! With those parameters:", element, text, height, distance, r, g, b, alpha, size, font, k) After checking that and it still doesn't trigger, that most likely means that you triggered it before the client has loaded his code.
-
How are you even creating that vehicle when the event "onClientMarketHit" only triggers clientside? If you used that code serverside, there wouldn't be any vehicle in the first place.
-
RenderTargets can be used to create boxes, which can act as an mask so that only a little part can be visible and the rest gets cut-off. If you are going to work with renderTargets try to prevent doing re-drawing inside of the renderTarget. Only re-draw when you actually made changes. Sometimes using multiple renderTargets can also reduce re-drawing times. (For example if you have drawn 20x text which is already drawn inside of another renderTarget) Capturing the pixels inside of the renderTarget is a very CPU intensive process. For the rest there is not much you have to worry about.
-
It looks like your serverside script is running clientside. So yes those are probably related.
-
Because you created them clientside. They are not synchronised with serverside, therefore it would cause desync if you could drive them. To solve that, create the vehicle serverside. You probably hit the marker while driving a vehicle? The event is triggered for the vehicle as well as the player. To solve that, check if the hit element is the localPlayer. if botdeniz == localPlayer then end
-
I will lock your topic if you keep making useless bumps. If nobody answers your question or the answers are not satisfying, then you didn't ask the right question as simple as that.
-
You are inserting the JSON string inside of a table, which you convert back to a JSON string. Which ends up in ??? local s = fromJSON(dd) table.insert(dd, s) setAccoountData(getPlayerAccount(v),"SkinsT", toJSON(s))
-
And which part of the code doesn't work? The saving part? The loading part? The sending part? The grid display part? You know better than me that you have to debug each individual part in order to figure out were the issue is located.
-
I am not sure what the problem is. But you can assign data to a grid item. https://wiki.multitheftauto.com/wiki/GuiGridListSetItemData Including tables.
-
Shouldn't you receive this error? Because it looks like there is a typo. input:*: attempt to call a nil value (global 'setAccoountData')
-
That is because it is also send to players that didn't load the resource. Instead, send it right back to the sender: client addEvent("onClientSideStarted", true) addEventHandler("onClientSideStarted", resourceRoot, function() triggerClientEvent(client, "trig1", root, var1) end) See also this tutorial/enchantment, it does error handling for you as well as providing things like callbacks:
-
Attaching a non existing marker to an addEventHandler. You would have received an error of that... local markerParent = createElement("marker-parent") --[[ markerParent = parent marker = child marker = child marker = child addEventHandler listening to: markerParent marker marker marker ]] function buyFish(satinAlim) local money = getPlayerMoney(localPlayer) if (money >= 300) then triggerServerEvent("buyFish", resourceRoot) outputChatBox("You have bought a fish food.") takePlayerMoney( 300 ) local marker2 = createMarker (1631.6253662109, 576.00537109375, 0.7578125, "cylinder", 1.2, 600, 600, 900, 1000 ) setElementParent(marker2, markerParent) else outputChatBox("You do not have enough amount of money.") end end function botGetir(botdeniz) botarac = createVehicle(473, 1633.3326416016, 563.24768066406, -0.55000001192093) end addEventHandler("onClientMarkerHit", markerParent, botGetir)
-
Where are your debuglines? There are absolutely 0 of them in your code.
-
You didn't update the code, so I can't say anything. That tutorial is using different sourceElement, baseElement and sendTo elements. Nothing like your code.
-
triggerClientEvent("dxDrawMessageText", getRootElement(), message) triggerClientEvent("dxDrawMessageText", getRootElement(), "") addEventHandler("dxDrawMessageText", getLocalPlayer(), function(message) triggerClientEvent("dxDrawMessageText", resourceRoot, message) triggerClientEvent("dxDrawMessageText", resourceRoot, "") addEventHandler("dxDrawMessageText", resourceRoot, function(message) If you do not understand how the event system works, then you can better replace the baseElement of the triggerclient/serverEvent + addEventHandler with resourceRoot until you have studied that. Documentation: https://wiki.multitheftauto.com/wiki/AddEvent https://wiki.multitheftauto.com/wiki/Event_system https://wiki.multitheftauto.com/wiki/AddEventHandler https://wiki.multitheftauto.com/wiki/Element_tree https://wiki.multitheftauto.com/wiki/Event_Source_Element
-
Probably with: https://wiki.multitheftauto.com/wiki/DxCreateScreenSource And capturing and drawing the screen on the correct processing order. https://wiki.multitheftauto.com/wiki/Game_Processing_Order
-
It has nothing to do with maths. But with breaking down the instructions (for the computer) in to pieces and debug every piece individually. When running this code you gave the computer 4 instructions. 1. Load the file Runs a debug line if added. 2. Attach the eventhandler (returns true if attached, which is a value you can debug) 3. The event is fired, which calls the function you have attached. If you did add a debug line here, you would have noticed that the code didn't run. (If the debug line is not visible, then there must have been something with the addEventHandler) Hmmmmaybe compare the code to something similar that does work? 4. Call your custom function. Check which value it returns. This is something that takes time to learn. So maybe put some more time in debug your code in details. This will save you a lot of time in the long run.
-
See string.sub from my previous reply. It is used to select a range of characters. So if you know the length with string.len , then you can select a shorter range of characters.
-
Locked (no support for this kind of things, please read the forum rules)
-
I am not a string reg prof, but it works... ? local theString = "254646" local length = string.len(theString) local visibleCount = math.max(length - 2, 0) print(string.rep("*", string.len(string.sub(theString, 1, visibleCount))) .. string.sub(theString, visibleCount, length))
-
See https://wiki.multitheftauto.com/wiki/Split http://Lua-users.org/wiki/StringLibraryTutorial string.len string.rep local emailParts = split("[email protected]", "@") iprint(emailParts[1]) iprint(emailParts[2]) iprint(emailParts[1] .. "@" .. emailParts[2]) iprint(string.rep("*", string.len(emailParts[1])) .. "@" .. emailParts[2])
-
You can't index a non existing table. So you have to check if it exist before indexing a second time. if result[1] then
-
I am not sure what uid is. But normally you would have 1 column called: id Which auto increment when items are added. This value makes sure that each item added is unique. In some cases for example a login system you can also set the username as primary key, which is to prevents duplication for the usernames. So make sure that you understand your own data. LIMIT is used to select only a maximum items. If you need 1 item, you put the limit to 1, so that the database knows that it has to stop when it found what it is looking for. - Selecting a max amount of items. - Increase the performance.
-
Use the SELECT query. It is not as if you should combine queries. The error is given because it is protecting itself from item duplication. Which means that it already went wrong. SELECT uid FROM accs WHERE uid = ? LIMIT 1
