-
Posts
6,062 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
If you could test if elementdata does get send to the clients 100% successfully, even if it changes rapidly, then you might consider sending small updates using elementdata. So for example the player joins the server. Global: Every time you update something of your table, you update a counter which indicates which id this data contains. You wait for the resource to be load clientside. Then you send a triggerEvent from clientside to serverside. (saying: "I want cookies") The server sends with triggerEvent the whole table. (Included a ref id from the last update) From that moment you will be fetching elementdata from serverside and update the table. (the elementdata contains only the parts that are updated) This id you give to your elementdata can indicates if you are missing information. For example packets: 80, 81, 83 <-- Ey, I am missing update 82. I would say this is a very experimental thing to do, since I do not know what happens when elementdata stacks up. But I can tell you that using a trigger for an large amount of updates isn't a solution.(unless you update the table only ones in a while)
-
@Einheit-101 root will accept everything, included players. There is nothing wrong with that.
-
There is also another method, which works with the crosshair: https://wiki.multitheftauto.com/wiki/OnPlayerTarget https://wiki.multitheftauto.com/wiki/OnClientPlayerTarget Might be interesting for you as well. You can use it as fallback when you do not get it working with the cursor. Good luck!
-
Show meta.xml Remove: gun1, gun2, gun3 and gun4 from the triggerServerEvent. Those elemens are clientside elements which shouldn't be trigger able.
-
Ehm? I am here to help you else I wouldn't have read your post. Also you didn't asked us where you could add the spawn part in your code. You only asked us if we could take a look at the code where you tried to add it. To answer your new question: Spawn the player between line 16 and line 17. Also spawn the player between: 38 and 39. To fade the camera see code: addEventHandler("onPlayerSpawn", root, function () fadeCamera(source, true, 0.5) end)
-
https://wiki.multitheftauto.com/wiki/GetPedMoveState or/and https://wiki.multitheftauto.com/wiki/GetPedSimplestTask or/and https://wiki.multitheftauto.com/wiki/GetPedTask or maybe this works as well: https://wiki.multitheftauto.com/wiki/GetPedTargetStart
-
Can you script? If yes, then I will give you all functions you need. If no, then you should find a paid scripter.
-
OnClientPlayerWeaponFire should be triggered.(client version) For serverside it is onPlayerWeaponFire and not onPlayerWeaponFired. (serverside version) I am not sure if this event will trigger on a frame render rate.
-
I do not see anything related to spawning or fading the camera in this code. It is a 100% failure if there is no code... Would you mind stop fooling us? It is not even close to funny.
-
An X amount of pixels on your resolution is automatic scaled to all other resolutions. This for example will create a perfect centred rectangle scaled for all resolutions: dxDrawRectangle((screenW * 0.5) - (50 * scalefactor), (screenH * 0.5) - (50 * scalefactor), 100 * scalefactor, 100 * scalefactor, tocolor(0, 0, 0, 145), false)
-
I recent figured out that this is an easy way to calculate your absolute resolution to relative values: local yourScreenYResolution = -- <fill in> 900 wasn't it? local screenX, screenY = guiGetScreenSize() local scalefactor = 1 / yourScreenYResolution * screenY -- You created something of 50 pixels on 1440 x 900. outputDebugString(scalefactor * 50) -- And now it will be rescaled on all other resolutions correctly. Try it and don't buy it.
-
local damageTimeCount = 0 addEventHandler("onVehicleDamage", getRootElement(), function(loss) damageTimeCount = damageTimeCount+1 local health = getElementHealth(source) - 250 local vehHealth = math.floor(health / 750 * 100) if vehHealth < 1 then setElementHealth(source, 250) end iprint("damageTimeCount: " .. damageTimeCount .. ", vehHealth 1: ", vehHealth) setTimer(function (vehicle, damageTimeCount) local health = getElementHealth(vehicle) - 250 local vehHealth = math.floor(health / 750 * 100) iprint("damageTimeCount: " .. damageTimeCount .. ", vehHealth 2: ", vehHealth) end, 50, 1, source, damageTimeCount) end) What is the result when you use this code?
-
Almost as if SA-MP is missing some animations. Checked if it maybe had to do with the glitches. https://wiki.multitheftauto.com/wiki/SetGlitchEnabled But it seems that is not it. I also checked if it had to do with the FPS. (Which often causes animation/movement changes when it is higher than 30 fps) But it seems that is it not the cause either. Checked: setPedWalkStyle, which is also not responsible for it. If GTA san doesn't have this slowdown effect, then I guess it has something to do with improving the synchronization. If you do not slow down the animation, it might cause a small (visible) teleportation for other players because the direction velocity changes too quick.
-
That has probably to do with the bandwidth saving (and maybe also finding it hard to decide which player should sync the vehicle).
-
First start with debug the variable: ? iprint("vehHealth: ", vehHealth) If this is oke, then show me how you create your table.
-
Afaik the loss has already been subtract from the vehicle health. This should be enough: (There is no need for convert it to integer, since a float number is more exact) local vehHealth = getElementHealth(source)
-
Most likely it is because this file loads later than the file that is already using WorldRadar. In short: You can't use something which hasn't been loaded yet. To solve that problem, you can execute code after ALL the code has been loaded using the event: 'onClientResourceStart'. It is clientside right? (for serverside use onResourceStart) function Map.start() MiniMap.start() WorldRadar.start() end addEventHandler("onClientResourceStart", resourceRoot, function () Map.start() end)
-
WorldRadar Doesn't contain a value. (which should contain a table) You can check if WorldRadar does have a positive value, by writing it like this: if WorldRadar then -- code that uses WorldRadar end This will stop the errors/warnings, but doesn't guarantee that the script will operate as pleased. So make sure that: WorldRadar does contain a valid value.
-
You want to know where you made a mistake? Then this tutorial is perfect for you:
-
Are you talking about the moving speed or the time when the ped can move freely again? For moving freely you need to edit the anim_breakout_time property. Set it at 0. https://wiki.multitheftauto.com/wiki/SetWeaponProperty If this is not what you mean, then I did like to see that (not created yet) video.
-
no, I am not expecting that. I am expecting it to create a new copy of the default state of the block every time the function has been called. Which is lua actually doing at the moment. It is just strange that when the function (that has been created in testVariable) is destroyed, the block(copy) where it has been created also gets destroyed. I know it is complicated.
-
It is indeed a kinda unexpected/ yet expected that testVariable remains part of the scope per function. But the main reason why I posted this, is: function testFunction () local testVariable = 100 local function firstFunctionInBlock () print("first function, testVariable: " .. testVariable ) testVariable = testVariable + 1 end local function secondFunctionInBlock () print("second function, testVariable: " .. testVariable) testVariable = testVariable + 1 end return function () firstFunctionInBlock() secondFunctionInBlock () end end This new created function is created inside the function block and yet it is the reason why this block remains to exist. If this function is destroyed it should automatic clear the whole function block with the garbage collector: Which has been created when the testFunction is called: local newCreatedFunction = testFunction() function testFunction () local testVariable = 100 local function firstFunctionInBlock () print("first function, testVariable: " .. testVariable ) testVariable = testVariable + 1 end local function secondFunctionInBlock () print("second function, testVariable: " .. testVariable) testVariable = testVariable + 1 end return function () firstFunctionInBlock() secondFunctionInBlock () end end