Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. First set ammo. https://wiki.multitheftauto.com/wiki/SetWeaponAmmo
  2. I am not sure, I hardly needed them. Just run the example of the wiki, to figure our what you need. https://wiki.multitheftauto.com/wiki/GetPedTask function displayMyTask () local x,y = 100,200 for k=0,4 do local a,b,c,d = getPedTask ( getLocalPlayer(), "primary", k ) dxDrawText ( "Primary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y ) y = y + 15 end y = y + 15 for k=0,5 do local a,b,c,d = getPedTask ( getLocalPlayer(), "secondary", k ) dxDrawText ( "Secondary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y ) y = y + 15 end end addEventHandler ( "onClientRender", root, displayMyTask ) (x and y are screen positions) (a, b, c, d are the task information) You can also use bindkey: https://wiki.multitheftauto.com/wiki/BindKey But that doesn't tell you if a ped is actually doing the animation/task. bindKey("fire", "down", function () end)
  3. https://wiki.multitheftauto.com/wiki/GetPedTask
  4. Using JSON as Dimos7 said. Or just use directly a table: do -- set local theTable = {a = 100} setElementData(player, "hitMarkers", theTable) end do -- update local theTable = getElementData(player, "hitMarkers") theTable.b = 200 setElementData(player, "hitMarkers", theTable) end do -- debug local theTable = getElementData(player, "hitMarkers") iprint(theTable) end Information about what is allowed inside of this table.
  5. DXT5 is the highest quality and as you said it does support alpha blending. I would pick DXT1 for low quality textures like sand or grass(floor layer). Which shouldn't be too high quality because of the old Anti-Aliasing in GTA. Saving that ram is just so important for old gpu's while drawing a lot of textures. Saving half of the ram, by just compressing it until the minimum. dxt3?, I wouldn't pick it either.
  6. you can use the in-game web browser to do the svg thingy.
  7. @Pirulax That is indeed related. The larger the texture, the more memory and processing time it cost. (DXT compression matters) So yes, to serve lower quality textures or none for players with lower fps is a solution.
  8. There is a type of element in MTA called textures. Which can be created with this function: https://wiki.multitheftauto.com/wiki/DxCreateTexture Textures are images saved in to the memory. Which makes them very fast to draw images in-game. You can also draw images by path, which is a very slow process because they have to be read out by file every frame. Shaders can use textures to draw them dynamic on in-game elements (and even animate them.) Which is this guy probably doing at the moment using community resources. But shaders and textures might be fast but for old computers they can be lagy.
  9. https://wiki.multitheftauto.com/wiki/OnClientPreRender If timeslice is higher than 25 ms for a while, then remove the textures. 25ms = 40 fps. Btw write it yourself, those are the rules of the scripting section!
  10. https://wiki.multitheftauto.com/wiki/GetPedTargetStart It starts here.
  11. The health loss is already removed of the player his health data when this even is fired(not from the visual representation). Make sure you add the loss to the health data before you make your calculations. Parameters element attacker, int weapon, int bodypart [, float loss ] LOSS
  12. IIYAMA

    Moon??

    It might also be one of the shader resources on your server, which overwrites the moon texture.
  13. local findRotation = function ( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end local findPitch = function (camerax,cameray,cameraz,pointx,pointy,pointz) local dX=camerax-pointx local dY=cameraz-pointz local dZ=cameray-pointy local pitch=math.atan2(dY,math.sqrt(math.pow(dZ,2) + math.pow(dX,2))); return pitch end local targetX, targetY, targetZ = 0, 0, 0 local elementX, elementY, elementZ = getElementPosition(projectile) local rotZ = findRotation(targetX, targetY, elementX, elementY) + 180 local pitch = findPitch(targetX, targetY, targetZ, elementX, elementY, elementZ) local rotX = pitch*(180/math.pi) These are the global math functions you need, which I ripped out of my own script. You probably need some adjustments to them in order to make it work for your script. The variable names do speak for them self, so good luck with it!
  14. The easiest way would be creating an object on the map(server-side strongly recommended because of the synchronization). And let a heat seeking rocket fly to it.
  15. @CleyzChan How about you write the things in JavaScript, then I will explain you how to write those in Lua?
  16. If you know JavaScript, then lua is just a little kid. Start running some basic code at a demo for example: https://www.lua.org/demo.html JavaScript The syntax is different, but the rules are almost the same. The most confusing part in lua compared to JS might be the fact that: `let` variables which are written down with the `local` key word. Variables without declaration are available in every script (within the same resource). (also known as globals) `const` and `var` variable types do not exist in lua. There are document code blocks. (which in Javascript you need iffy's to do this.) Arrays and objects do not exist in lua. But tables can be used as an array, object and both at the same time. Tables used as arrays start at the index 1 instead of 0.
  17. You might attach a function as string on to the root and load per resource the string? Resource 1. setElementData(root, "allFunctions", "function newFunction() end", false) triggerEvent("allFunctions", root) Resource 2, 3, 4, 5, etc. addEvent("allFunctions", false) local function loadAllFunctions () local allFunctions = getElementData(root, "allFunctions") if allFunctions then loadstring(allFunctions)() removeEventHandler("allFunctions", root, loadAllFunctions) end end addEventHandler("onResourceStart", resourceRoot, function () addEventHandler("allFunctions", root, loadAllFunctions) loadAllFunctions() end) I do not recommend it muhahahah but maybe it works for you lol. really bad practice
  18. IIYAMA

    topbarchat

    I do not understand the decisions you made in your code either, especially if you do not write comments. So I do recommend you to rewrite your code or at least write some comments in it. AFAIK you can use the same Y start point of the text for your rectangle. How about you give it a try? (sY / 900) * (dxMessagesY[index] * 2) + 1
  19. A ped isn't a player or a vehicle(with syncer). So no they are not synced in case of a ped. And this is about: Optional Arguments NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments. posX, posY, posZ: float starting coordinates for the projectile. They are coordinates of creator by default. force: float representing the starting force for throwable projectiles. target: element target used for heat seeking rockets. rotX, rotY, rotZ: float starting rotation for the projectile. velX, velY, velZ: float starting velocity for the projectile. model: Integer representing the projectile's model, uses default model for weaponType if not specified. https://wiki.multitheftauto.com/wiki/CreateProjectile With other words, if you change projectiles in to houses(objects), they will not look like houses for the remote-players*. *(other players than the creator of the projectile) yea yea, I know, you can also make cows fly as in age of empire 1. /Jack be Nimble
  20. IIYAMA

    topbarchat

    There is no need to do complex stuff. It can be very simple if you spend some time on finding a logic solution. Untested code. local blockSize = (sY / 900) * 10 Define the block size local index = #dxMessages + 1 dxMessages[index] = {message = "hi"} -- set position data dxMessages[index].positionY = blockSize * (index - 1) Define it's position if item is added last local index = 1 -- move all items 1 down for i=1, #dxMessages do dxMessages[i].positionY = dxMessages[i].positionY + blockSize end -- insert at the start of the table and push all other items to the next index. table.insert(dxMessages, index, {message = "hi"}) -- set position data dxMessages[index].positionY = blockSize Define it's position(s) if item is added first. While rendering: for index = 1, #dxMessages do local messageData = dxMessages[index] end --reverse for index = #dxMessages, 1, -1 do local messageData = dxMessages[index] end Just use a normal loop. So you have full control over it. And now you can rock! Box/text from bottom to top. Please edit to your layout. dxDrawRectangle(sX / 4 + 1, sX - blockSize, (sX / 4) * 3 + 1, 0, tocolor(0, 0, 0, 93), false) Loop local startX, startY = sX / 4 + 1, sY - messageData.positionY - blockSize local endX, endY = (sX / 4) * 3 + 1, startY - blockSize * #dxMessages dxDrawText(messageData.message, startX, startY, endX, endY, tocolor(0, 0, 0, 255), (sX / 1440) * 1.1, "default-bold", "center", "center", false, true, false) Something like that...
  21. It is indeed a big problem. Optional. You can tell all players that are closeby that a projectile is created. (Which you can attach to an element serverside to get full control. ) When it blows up at one of the clients, you can tell all other clients to move their projectile to the right position and detonate it. It is not 100/100, but it can be considered as a kind of synchronization/validation.
  22. IIYAMA

    topbarchat

    Where is your rectangle?
  23. @LeroY https://wiki.multitheftauto.com/wiki/GetElementBoundingBox Bounding box. Please read the information carefully.
  24. IIYAMA

    XML Join

    @anufis_ok Check if a player is logged-in with: https://wiki.multitheftauto.com/wiki/IsGuestAccount
  25. The maps that are exported from the map editor do have a script to make this possible. But of course without understanding lua, you will not be able to achieve this if the end format isn't the same.
×
×
  • Create New...