Jump to content

Zango

Members
  • Content Count

    641
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Zango

  1. If you want to get the target in the center of the screen, you can use getCameraMatrix. It returns the camera position and lookat position, which is a unit vector from the camera position, so you can easily multiply it to get a point further out. Made the following so you can see if thats what you need. local scrW, scrH = guiGetScreenSize() local maxTargetDistance = 100 addEventHandler("onClientPreRender", root, function() local cx, cy, cz, lx, ly, lz = getCameraMatrix() local px = cx + (lx - cx) * maxTargetDistance local py = cy + (ly - cy) * maxTargetDistance local pz = cz
  2. To see errors and warnings from your script, use /debugscript 3. The problem here is you are parsing a resource element into triggerClientEvent where it expects a player. function ShowImage (player) The player here is a resource, because you have bound it to onResourceStart. If you want to send this image to everyone on the server, use root as "sendTo" parameter. triggerClientEvent ( root, "onClientGotImage", root, response ) I've made a few changes to it, see the comments here: -- server function ShowImage() outputChatBox ( "event called, fetching image..."
  3. I tested it and it looked fine. Can you show with a screenshot what looks wrong?
  4. Try using modulate_add as blend mode instead of add before fading it (line 18)
  5. What doesn't work? Are you getting an error? Use /debugscript 3
  6. Do you want to fade two images with each other? Or fade the current image to nothing and then fade the next image from nothing? Use alpha in tocolor to fade it. (red, green, blue, alpha). dxDrawImage(0, 0, screenSize.x, screenSize.y, backgroundTexture, angle, 0, -120, tocolor(255, 255, 255, 255)) To fade it a bit dxDrawImage(0, 0, screenSize.x, screenSize.y, backgroundTexture, angle, 0, -120, tocolor(255, 255, 255, 100)) Now you need to add or subtact a bit of alpha every render. If you add 1 alpha, the effect will take 255 frames, so about 4 seconds at 60 FPS. Let me k
  7. If you haven't already, you need to find the scoreboard resource, by default it will be in server\mods\deathmatch\resources\[gameplay]\scoreboard Scoreboard has a few different settings you can adjust. In meta.xml at the bottom you will find settings to toggle whether teams and country flag will always or never be shown. You can also disable colorcoded names there. You probably want to force teams to be shown. Change <setting name="*forceShowTeams" value="false" to <setting name="*forceShowTeams" value="true" Besides those settings there are some the players can change
  8. Head into server\mods\deathmatch\resources\[managers]\mapmanager. Open meta.xml. Find <setting name="*color" value="#E1AA5A"/> Change the hexadecimal value to fe. value="#0000FF". Go here to convert RGB to Hex: https://www.rgbtohex.net/rgbtohex/
  9. You can open a file handle on server.log and read it periodically. Move the pointer to end of file after opening it initially, and read from it at some interval (500ms should feel like realtime).
  10. I made the below function as you might find it useful to animate multiple floating arrows, as alternative to the static approach above. Use createAnimatedArrow(...) instead of createMarker(...) for your arrow. It uses the stream in/out events so we don't waste CPU on markers that are far away. You could further optimise it to bind/unbind the render event at the first and last stream in / out, saving 1 pairs call. local markers = {} local animationMethod = "InOutQuad" -- What easing function to use, see https://wiki.multitheftauto.com/wiki/Easing local animationTime = 1000 -- The
  11. It's worth mentioning you can carjack a dead ped, if you are looking to make a workaround. However it's almost impossible to create a workaround that looks good and works well. I've considered a lot of approaches for a workaround, but it's ridiculous for such a basic mechanic that should just work. Better to focus our efforts on fixing it in MTA.
  12. There is no way for peds (bots) to enter a car like players do. You can only send them directly to the car with warpPedIntoVehicle.
  13. local weapon_table = { -- model, id [30] = { [422]=10, --Bobcat [596]=9, --PoliceLS }, } function getElementSpeed(theElement, unit) -- Check arguments for errors assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") local elementType = getElementType(theElement) assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .
  14. Hello and welcome to MTA. Your code looks fine, looks like you store the rotation correctly. I think the issue is in your database. You might have a row in your "vehicles" table that doesn't contain anything in rotation_x. So your vehicle is not created on line 34 (MTA gives you a warning). But then your code fails because it thinks vehicle_object is created (line 38). So try deleting the "vehicles" table and creating it again.
  15. Without testing it, the matchingDimension parameter should work and tell you if the element hit the colshape in the right dimension. Can you post your code?
  16. Use the partial animation crry_prtial for walking while holding the crate. Set last parameter to true (freezeLastFrame). setPedAnimation(localPlayer, "carry", "crry_prtial", 0, false, true, true, true)
  17. Pass 0 (or something else) in the 'time' parameter and controls should work. setPedAnimation(localPlayer, "ped", "run_fat", 0)
  18. Do you want a player to control it? Take a look at the weapon creation functions here and attachElements.
  19. Try not using -1 in the time parameter. setPedAnimation(localPlayer, "ped", "run_fat", 0)
  20. (math.deg(aSine) + 90) % 360 Add 90 to get 0 at the green line, and use modulus (% 360) so it counts from 0 when it reaches 360 (361 % 360 is 1)
  21. Lua has math.deg to convert radians. You can add 180 degrees to get 0-360. If that was your question? local sX, sY = guiGetScreenSize() local centerX = sX/2 local centerY = sY/2 addEventHandler("onClientRender", root, function() if isCursorShowing() then local px,py = getCursorPosition() local mx,my = sX*px,sY*py local aSine = math.atan2(my-centerY, mx-centerX) local degrees = math.deg(aSine) + 180 dxDrawText(tostring(degrees), 400, 400) end end)
  22. -- ***************** -- Beginning of colorful GUI functions -- ***************** genelGuiTablo = {} --guiCreateWindow wtablo = {} --guiCreateButton btablo = {} --guiCreateGridList Ltablo = {} --guiCreateMemo mtablo = {} --guiCreateEdit etablo = {} function resimOlustur(isim) if fileExists(isim.."png") then return isim.."png" end local texture = dxCreateTexture(1,1) local pixels = dxGetTexturePixels(texture) local r,g,b,a = 155,155,155,155 dxSetPixelColor(pixels,0,0,r,g,b,a) dxSetTexturePixels(texture, pixels) local pxl = dxConvertPixels(dxGetTexturePixels(texture),"png") local
  23. Your colorful GUI is created by the code you posted. It replaces the MTA functions. For example in guiCreateWindow it creates an image as background instead of an actual window. Same for the buttons. And then it stores the original MTA function in _guiCreateWindow. You just need to take that code and put it into the other GUI. Post the code for the arabic GUI and I'll do it for you.
  24. I think you created two topics on the same issue m8
  25. Use the <> symbol to put your code into the right format when posting You can unpack your table values into variables like this local x, y, z = unpack(fix[math.random(#fix)]) JailEscapeMarker1 = createMarker(x, y, z, "arrow", 1.5, 255, 255, 0, 150) You can also do this local randomKey = math.random(#fix) JailEscapeMarker1 = createMarker(fix[randomKey][1], fix[randomKey][2], fix[randomKey][3], "arrow", 1.5, 255, 255, 0, 150)
×
×
  • Create New...