Jump to content

IIYAMA

Moderators
  • Posts

    6,085
  • Joined

  • Last visited

  • Days Won

    215

Everything posted by IIYAMA

  1. They are not by default, it is something you have to make. When the custom weapons got released, I created my own script for it. You should do it too if you want it that badly.
  2. Show me what you can do. Tell me your prices and I am only able to pay directly from bank to bank. (I am not using any kind of paypal) What do I expect from you? - Per map 3 versions of it. (map style remains the same) - Inviting me in the map editor. - Quality. - Bug tracking. How do I pay: - Paying from bank to bank. - I am paying 20% of the price during the first visit, if everything is OK. The remain amount afterwards.
  3. The things that are lagging here: [color=#FF0000]- timers (destroy and create) < Especially that one. (and inside a loop)[/color] - creating new functions over and over. (and inside a loop) - triggerServerEvent (uses more memory than usually) - triggerEvent (uses more memory than usually)
  4. It will use more memory than static code, that is a fact. But what more important is, is what happens inside of that loop and how many times it got executed. Do you want to know if your code is lagging? You will know if your timeSlice starts increasing. (see default timeSlice) When your code speed is slower than the default timeSlice, your fps will drop and then you know that it is lagging. But this is per pc differed of course. With the code below my execution time is 5/6 ms. Default timeSlice: 60 fps will have circa an execution time of 17 ms. How do I get this value? It is frames per second so: 1000 ms / 60 fps = 16,666666666666666666666666666667 addEventHandler("onClientPreRender",root, function (timeSlice) local startTime = getTickCount() for i=1,10000 do -- add your code here -- local x,y,z = getElementPosition(localPlayer) ------------------------ end for i=1,10000 do -- add your code here -- local x,y,z = getElementPosition(localPlayer) ------------------------ end for i=1,10000 do -- add your code here -- local x,y,z = getElementPosition(localPlayer) ------------------------ end dxDrawText("Code speed: " .. getTickCount()-startTime .. " ms, time between frames: " .. timeSlice .. " ms.",300,300) end)
  5. 1) Get the extend line function from the stealth resource. (used for the laser) 2) Extend the line from getPedTargetStart t/m getPedTargetEnd t/m as far as possible. and you got your target.
  6. IIYAMA

    Save Weapon

    Doesn't work with all weapons, some weapons (minigun/spray can) do have a fire rate of 1 bullet per frame. They will always fire 1 more bullet ahead of the toggleControl block.
  7. It is enabled for a reason, but if it works for you then disable it.
  8. https://community.multitheftauto.com/in ... s&id=11068
  9. By reducing database/xml accessing. It uses the most of the memory and is most of the time the thing that will crash your server. Also keep an eye on infinity loops or tables that don't get cleaned(memory leak).
  10. There are no custom weapons on serverside, event is useless.
  11. The glass object would be enough.
  12. Destroy elements? The cleanest way is porbably setElementParent. When the map stops the children will be destroyed too.
  13. Well this will do it, without rendering with setCameraMatrix. But aiming with the gun is kinda impossible. local cam = getCamera() setElementPosition( cam, 0,0,0 ) attachElements( cam, localPlayer, 0.2,-2,0.8, 0,0,0 )
  14. You could try to attach an army door to it and set the alpha to 0.
  15. Check out this example on wiki: https://wiki.multitheftauto.com/wiki/GetCamera I haven't tried it myself, but it might do what you want(if you edit it ofcourse).
  16. or: https://wiki.multitheftauto.com/wiki/On ... bjectBreak addEventHandler("onClientObjectBreak", root, function(attacker) if getElementModel( source ) == 3851 then cancelEvent() end end ) This code will stay working when you start another map with the same objects etc. This is a solid solution, without bugs. It only uses a little bit more memory, but you won't notice it. Enjoy.
  17. Depends, you can render your peds as the image you showed me. A far as I can see, that is what you want to do. Or do you mean something else by 3D object image ? And about what kind of files/formats are you talking about?
  18. If you understand shader code (.fx), you might be able to do it the hardcore mode. But that will be a lot to learn next to lua. But for now: https://wiki.multitheftauto.com/wiki/Dx ... reenSource
  19. There are 3D dx functions...
  20. setControlState Add that function with the same arguments as toggleControl. So one is for toggling and one for change the state. Also put between line 11 and 12 another else, for disabling the control.
  21. 1: How many times does this function gets called? 2: What is the position after the reset? 3: And what is the position before you affect any of the components? 4: Does the function getVehicleComponentPosition moves the component down? Or the result is, moved down? Debug the results. After what you told me, I would say resetVehicleComponentPosition doesn't reset everything well. But if that is the case, make sure you backup the original position. (or save it) local modelComponentPosition = {} local model = getElementModel(source) local bufferModelComponentData = modelComponentPosition[model] if not bufferModelComponentData then modelComponentPosition[model]= {} end for k in pairs ( getVehicleComponents ( source ) ) do if ( k ~= "exhaust_ok" ) then local x, y, z = bufferModelComponentData and table.unpack(bufferModelComponentData[k]) or getVehicleComponentPosition ( source, k ) setVehicleComponentPosition ( source, k, x, y, z) if not bufferModelComponentData then modelComponentPosition[model][k] = {x, y, z} end end end But maybe you can better generate a xml document with original positions, then you won't have trouble with bugs.
  22. Well, combine the code from a both and you have it. But make sure you have a table with valid players you can loop through, so the variable "player" can be defined.
  23. local x,y,z = getElementPosition(chair) local sx,sy,sz,_,_,_ = getCameraMatrix(player) if not sx then sx,sy,sz = getElementPosition(player) end setCameraMatrix(player,sx,sy,sz,x,y,z) I don't know what you want, explain better with less nonsense. local lastPosition = {} setTimer(function () if not lastPosition then local x,y,z = getElementPosition(chair) if getDistanceBetweenPoints3D(x,y,z,lastPosition[1],lastPosition[2],lastPosition[3]) > 0.1 then outputChatBox("chair moved!") lastPosition = {x,y,z} end else lastPosition = {getElementPosition(chair)} end end,100,0)
×
×
  • Create New...