-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
You mean, people are applying their own mods? You should use https://wiki.multitheftauto.com/wiki/DownloadFile instead of triggerLatentClientEvent. To let the system check if the file is validated. If you use triggerLatentClientEvent you can check if the filesize has chanced, but you won't be able to check the timestamp of the creation/edit time. Only mta can do that, so it a risk.
-
Encrypting mods? Well against the ordinary stealer: https://wiki.multitheftauto.com/wiki/Base64Encode https://wiki.multitheftauto.com/wiki/Base64Decode or/But I recommend:(because of the custom key) https://wiki.multitheftauto.com/wiki/TeaEncode https://wiki.multitheftauto.com/wiki/TeaDecode or Make your own... What do you need: https://wiki.multitheftauto.com/wiki/FileExists -- Check if the file exist. https://wiki.multitheftauto.com/wiki/FileOpen -- Open the file https://wiki.multitheftauto.com/wiki/FileGetSize -- Read the file -- Decode the text/string/data of the file. https://wiki.multitheftauto.com/wiki/FileWrite -- Write the new decoded file (it is only temporary) -- Load txd or dff https://wiki.multitheftauto.com/wiki/FileDelete -- Delete the file. Yet pro's will be able to steal them.
-
This is not a place for requesting. Go read the forum rules. This section is only for scription support and other kind support related to that. Have a nice day.
-
Blue, I just gave you code to debug your code. What is the result?
-
Why don't you take a look of what really happens? If you don't know how your code behaves, you will have a hard time fixing it... addEventHandler("onClientRender", getRootElement(), function ( ) if isPedInVehicle(localPlayer) then if getElementModel( getPedOccupiedVehicle(localPlayer) ) == 520 then local veh = getPedOccupiedVehicle(localPlayer) local col2 = getElementData(veh, "r.col2") local col1 = getElementData(veh, "r.col1") if not isElement(col2) or not isElement(col1) then return end local x, y, z = getElementPosition(col2) local x1, y1, z1 = getElementPosition(col1) -- dxDrawLine3D(x, y, z,x1, y1, z1,tocolor(255, 0, 0)) -- debug line 1 -- z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 -- dxDrawLine3D(x, y, z,x1, y1, z1,tocolor(0, 0, 255)) -- debug line 2 -- local hit, x2, y2, z2 = processLineOfSight(x, y, z, x1, y1, z1) if not(x2) or not(y2) or not(z2) then x2, y2, z2 = x, y, z end -- dxDrawLine3D( x1, y1, z1,x2, y2, z2,tocolor(0, 255, 0)) -- debug line 3 -- local sx, sy = getScreenFromWorldPosition(x2, y2, z2) if not(sx) or not(sy) then return end dxDrawLine(sx, sy-12.9, sx, sy+12.9, tocolor(0, 255, 0), 2) dxDrawLine(sx-12.9, sy, sx+12.9, sy, tocolor(0, 255, 0), 2) end end end )
-
np. I wasn't sure if it would do what you wanted, but it seems it did.
-
Try something like this: function controlObject() if not objectInEditor then return end local camera = getCamera () local cameraX,cameraY,cameraZ = getElementPosition(camera) local objectX,objectY,objectZ = getElementPosition(objectInEditor) local x,y,z if pressedButton == "num_8" then x,y,z = getMatrixForward(camera,0,moveSpeed,0) elseif pressedButton == "num_2" then x,y,z = getPositionFromElementOffset(camera,0,0-moveSpeed,0) elseif pressedButton == "num_4" then x,y,z = getPositionFromElementOffset(camera,moveSpeed,0,0) elseif pressedButton == "num_6" then x,y,z = getPositionFromElementOffset(camera,0-moveSpeed,0,0) elseif pressedButton == "pgup" then x,y,z = getPositionFromElementOffset(camera,0,0, moveSpeed) elseif pressedButton == "pgdn" then x,y,z = getPositionFromElementOffset(camera,0,0, 0-moveSpeed) end if x then setElementPosition(objectInEditor, objectX+(x-cameraX),objectY+(y-cameraY),objectZ+(z-cameraZ)) end end addEventHandler("onClientRender", root, controlObject) I haven't build something like this before, so I have no idea how to script this perfect.
-
local camera = getCamera () -- > getPositionFromElementOffset https://wiki.multitheftauto.com/wiki/GetCamera and subtract the distance, between camera and your offset of the camera. Add those to the mapeditor object.
-
I don't understand your images.
-
A easier solution would be cancelling: Cancel: "onClientPlayerDamage" Cancelling firing when your teammate jumps in front of you, is pretty complex stuff for a beginner scripter. If you want that, you will have to work with: "onClientPreRender", getPedTargetStart, processLineOfSight, setControlState, etc.
-
Yes you can, the syncer(there is always one) will update the health for all. For the vehicles without a syncer, that might give some unexpected results. You will need to test everything properly. About something related to your script: But you have to keep in mind that the loss of the onClientVehicleDamage event isn't always the same as the damage that has been done. Example: Your vehicle has [b]1000 health[/b]. Your [b]damage is 400[/b] and then the [b]loss will be also 400[/b]. Your vehicle health will be set too: [b]1000-(400*0.3) = 880 hp[/b] But when your vehicle has [b]400 health[/b] and the [b]damage is 800[/b]. Then your loss will be [b]400[/b]. Your remaining health will be: [b]400*0.3 = 120 hp[/b] This isn't really a big problem because the burning starts at 250 hp. But keep it in mind that the results might not always be correct.
-
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.
-
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.
-
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)
-
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)
-
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.
-
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.
-
It is enabled for a reason, but if it works for you then disable it.
-
https://community.multitheftauto.com/in ... s&id=11068
-
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).
-
There are no custom weapons on serverside, event is useless.
-
The glass object would be enough.
-
Destroy elements? The cleanest way is porbably setElementParent. When the map stops the children will be destroyed too.
