Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. Then you first need to learn Lua. After that you need to learn a little bit from MTA scripting. (where to find stuff, how to read syntax, what is an element?) And when know the basics from both worlds, it would be the right moment to ask these kind of global questions. Sure, it is fine to ask these questions in your current programming state, but will not be very educational for yourself.
  2. It does matter which incorrect value you see, since it can point to the direction of the problem.
  3. onClientResourceStart triggers later than the moment you try to attach the addEventHandler below.
  4. onClientPlayerJoin doesn't trigger for the localPlayer, only for the remote players (players other than yourself). Use onClientResourceStart instead. Or use onPlayerJoin serverside, if you are not using triggerClientEvent event directly after that event (, then it doesn't matter if the client has loaded his resource). But if you are planning that in the future, then keep using onClientResourceStart. https://wiki.multitheftauto.com/wiki/OnPlayerJoin
  5. There is an up and down state. (press/release) https://wiki.multitheftauto.com/wiki/OnDgsMouseClick function BttnClick(button, state) -- button: left/right/middle -- state: up/down if button == "left" and state == "down" then end end
  6. I already gave you the components that are in my first post. I don't think I can explain it any better, unless you ask specific questions. DX is an (after) effect, not an element, therefore those rectangle/text things on your screen are nothing but "AIR". Which means that if you want to check if you clicked on them, you need to check if the cursor position is within the position of the things you are about to draw. If the concept of DX-UI is unclear, how about you try something that shows DX and but works as a GUI? There is also a whole wiki . @thisdp did a very good job including all features from the original GUI and more.
  7. Yes, when you use onClientRender, it will create the same GUI every frame. So if you have 60 fps, you will create 60 GUI's per second. The big difference between DX and GUI? DX is just an effect drawn on the te screen(every frame), while a GUI is actually a ready to use user interface. Use the following function on your GUI element(s). https://wiki.multitheftauto.com/wiki/GuiSetVisible To show and hide them. A variable state "openPanel", can be handy for the current state, but a variable value change will not be able to automatically close or open the gridlist. The function call 'guiSetVisible' is required.
  8. When you cancel the event, the tires can't be flatten. So you probably will have to do that manually. https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage element theAttacker, int theWeapon, float loss, float damagePosX, float damagePosY, float damagePosZ, int tireID >>> Set clientside (for people with high ping AND can also be used to prevent an overflow of data between client and server, since you do not have to communicate with the server when the tire is already flatten): https://wiki.multitheftauto.com/wiki/SetVehicleWheelStates > triggerServerEvent Set serverside: (Now other players should be able to see it, I am not sure if this is required because I do not know if this tire state is streamed when the setVehicleWheelStates function is called on clientside.) https://wiki.multitheftauto.com/wiki/SetVehicleWheelStates Or do not cancel the event when a tire is hit.
  9. This: results[1].password returns nil? First take a look in what is inside (this in most of the cases gives you the solution right away): inspect("Input password:", password, "\n Database results:", results) https://wiki.multitheftauto.com/wiki/DbExec dbExec doesn't support callback functions. It returns true when the connection is successful. This does not give you any information if the value is correctly set. dbExec(function() --triggerClientEvent(player, "loginSuccess", token) end, See here how to do that correctly (for insert): https://wiki.multitheftauto.com/wiki/DbPoll
  10. When I was playing sa-mp 4 years back, players were teleporting all over the place and hard to hit, so I don't think that so called "animation lock" is not there for nothing. Note: The slide glitch can cause de-sync, since it brings the player in a glitch state. I think the developers from MTA decided to put correct synchronization above free-movement(by glitches). You can use this easy weapon switch resource, if you want some more free-movement. sa-mp is indeed like the original game, it is just a shell around the original.
  11. You will have to add it when the server is not running. Because when the server stops, the loaded ACL/XML-DOM will be saved again. (which is old data from before the server has been started)
  12. I gave you an answer that would give your image a background color. If the answer is not helpful, then your question is incorrect. I also noticed before that your previous comment (hidden) was very toxic and disrespectful. Now you are trying to provoke a: Please behave yourself. LOCKED
  13. Use a second label[+] or use a gridlist instead. Put another image behind that. Just use a 1x1 size image with a single color. Disable the image as well, to make sure it doesn't goes in front of the other image.
  14. Afaik there is a Mouse up and down state. The second argument.
  15. Hmm, not sure. I haven't seen another one. Instead of this, you can also rotate this: dxDrawImage(Radar.posX + Radar.size, Radar.posY, -Radar.size, Radar.size, uMaskShader); Instead of: dxSetShaderValue(uMaskShader, "gUVRotAngle", math.rad(iCameraRotation + 180)); You could also try dxSetBlendMode ("overwrite"). I am not sure if it will overwrite the color or applying negative result and therefore doing the same as an inverted mask. > Never tried that before.
  16. You are not the only person that tried to create this. For my projectile I used the basic function: https://wiki.multitheftauto.com/wiki/DxDrawLine Which did indeed work. Created nice quality lines. While doing this project there was 1 wall I hit with project that ended up making it a failure. The map-draw resource required heavily on realtime updates for all 3 dimensions: x, y and z. Depending on the height of the camera, the order and opacity for each element was adjusted. This was required because the maps did also have multiple (building) floor. Which ended up in too many draws on a single rendertarget. While my computer could easily handle it, that was not for everybody the case. This was more or less the :~ty math I used:
  17. That only happens on a local server, since clients/players normally can't change the server `realtime`. Or your code is clientside by accident.
  18. Maybe stopping the engine does work as well. It is not as if I have already tried it before.
  19. Did you try to capture the pixels, transfer them to a new texture (and maybe enable mipmaps if needed)? (do not do this every frame) That way you wouldn't lose your rendertargets either after minimizing etc.
  20. Ask your self first: "how do I refer to any of these values?" Inspect your table: iprint(items ) Until you are able to get the first and the second value. After that (tell me when you are ready) we are going to take the easy route: guiCreateGridList. Because the concept of "dx items" seems to be a too high level for now.
  21. Set it to 0, every frame. https://wiki.multitheftauto.com/wiki/OnClientRender
  22. Do first all the steps from above. Then structure your table and sub-tables like this: local items = { { label = "Test1", value = 1 }, { label = "Test2", value = 2 }, { label = "Test3", value = 3 } } local item = items[1] iprint("The label is:", item.label, " and the value is: ", item.value) Main table: local items = { { label = "Test1", value = 1 }, { label = "Test2", value = 2 }, { label = "Test3", value = 3 } } Sub-tables: local items = { { label = "Test1", value = 1 }, { label = "Test2", value = 2 }, { label = "Test3", value = 3 } }
  23. Are the images drawn from path? (not recommended: line 68) If not, what are the arguments you use for the textures?
  24. You need this part of you previous code: local items = {{"Test"},{"Test1"},{"Test2"},} for i = currentCell + 1, maxRows + currentCell do local value = items[i] local key = i - currentCell - 1 if value ~= nil then -- check cursor here end end You need the position of the rectangle: dxDrawRectangle ( float startX, float startY, float width, float height ) screenW * 0.7499, screenH * 0.3269+((key)*27), screenW * 0.2380, screenH * 0.025 Combine that with this useful function (don't forget to copy the function from that wiki page): https://wiki.multitheftauto.com/wiki/IsMouseInPosition isMouseInPosition ( int x, int y, int width, int height ) And you need a break to stop the loop: --for i=1, 100 do --if something then --outputChatBox("found") break --end --end Can you build it with all the bricks from above?
  25. Before I forget. If you want to SET it per player. setElementData(player, "weaponmodel", --[[...]]) GET for yourself. getElementData(localPlayer, "weaponmodel")
×
×
  • Create New...