Jump to content

Einheit-101

Distinguished Members
  • Posts

    661
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Einheit-101

  1. Hello Community. I have created a table containing all Rhinos and SWAT vehicles. The script should remove a vehicle from this table if it gets destroyed or streamed out. Unfortunately if the FIRST tank gets removed by this function, all other elements get removed, too and if i remove the SECOND tank instead of the first, all elements behind the first tank get removed and so on. I just want to remove the tank that gets streamed out, not this one AND all others behind him. Whats wrong with my script? Thanks Guys! tanks = { } tankIndex = { } function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false end function removeFromTable() if getElementType( source ) == "vehicle" and (getElementModel(source) == 432 or getElementModel(source) == 601) then if table.contains(tanks, source) then tanks[tankIndex[source]] = nil --this one should only remove the tank that streamed out/got destroyed end end end addEventHandler("onClientElementDestroy", root, removeFromTable) addEventHandler( "onClientElementStreamOut", root, removeFromTable) function tank() for key, veh in ipairs ( tanks ) do outputChatBox(tostring(#tanks)) --this returns the number of all Rhinos/SWATs in the table for debugging. end end addEventHandler("onClientRender", root, tank)
  2. I just discovered this and watched the video. I am impressed. This brings MTA to a new level! I will include MANY of those effects in my WW2 server, with thanks to you, Samake!! I can't wait to try this asap!
  3. It's not really important for me at the moment, I have to do other stuff first. I plan some things like MG Nests and coaxial rhino machine guns.
  4. Thats no problem. Thanks a lot for the info, mate. I will see what unexpected results there are when no player is syncing the vehicle but if there is no syncer (player), then the damaged vehicle should nowhere be streamed in and that means, no player could harm the vehicle if its not visible. My biggest fear was, that eventually 3 or more players are calculating the damage like: 2000 health, 400 loss 3 players calculate and update the server: 3* 400 = 1200 loss for the server But if only one player does this job, everything is fine.
  5. My damage multiplier is always 0.3. That means, I can use just the client side setElementHealth? addEventHandler("onClientVehicleDamage", root, function (_, _, loss) setElementHealth(source, getElementHealth(source) - (loss *0.3)) cancelEvent() end ) And the sync of the damage will be fine without issues and triggerServerEvent?
  6. Hello community! I have some simple questions about the usage of client sided Scripts. Unfortunately, "onVehicleDamage" server side is very slow, I can't cancel it and it has almost no parameters. Now I have to use the client variant "onClientVehicleDamage". I want to check the damage (loss parameter), cancel the event and reduce the loss (only 1/3 damage should be applied). This works great on my client but when I use setElementHealth on my client, will this sync with the server when the vehicle is not controlled by the localPlayer? I think I have to use triggerServerEvent but when the vehicle is on fire, it would call triggerServerEvent a thousand times... And if two clients are on the same place, this event gets triggered twice, am I right? Or will onClientVehicleDamage only trigger for the client that is currently syncing the vehicle? If that's the case, is it possible to use setElementHealth on the "vehicle syncing client"? Or are vehicles synced by the server itself? Questions over questions. Greetings, the 101
  7. Are Custom weapons even synced nowadays? I wanted to make some scripts with custom weapons but i heard that they are still WIP, not finished and buggy/not synced/ have whatever problems.
  8. The project is still ongoing, i think a new source update will come very soon within the next 2 weeks (But no Eir release), the last update was 2 weeks ago. He is currently working on LUA Multi Threading support and some other "big things" (I dont know what exactly) but i track the repo almost everyday.
  9. Phew, I already thought MTA is almost dead because Google code got no update for a long time Nice to see this news!
  10. I made the same thing and just cancelled the explosion event But it had issues because the explosion was not cancelled for other players AND the new created missile was not synced with other clients, so I had a serious sync issue. I did not continue developing this since then due to lack of time but I will continue soon.
  11. You need to use something lower than 2 to increase the range. 3 decreases the range (I know, it doesn't make sense, but that's how it's calculated). If you want to get the same range for both vehicles I need to write a small workaround because the total range depends on the barrel length of your tank. Short barrel = low range. And SWAT has a very short gun.
  12. ProcessLineOfSight with custom effects and all that stuff is a dirty workaround imho. And not as precise as necessary. Explosions do not cause damage to the rhino. Fire does. You would need to use onClientExplosion and determine if a tank/swat is within a certain distance to this explosion and apply damage according to its distance from explosion center. Still there is the problem that explosions dont even trigger the event when they are not streamed in so even this approach needs testing. Server side onExplosion would fit perfectly but does not even exist and you would have to sync it manually. Oh, and there is another approach to do this with high precision by using Satchels and custom effects. Xwad, look my PM for your question about the range.
  13. Xwad, It is Not really possible to kill the rhino with SWAT because explosions cause no damage to rhino and this is not fixable (it is with some very dirty hax) so I can't provide a fix for this.
  14. Here, this vreload includes SWAT tank and a fix for the Ctrl / Alt shooting bug. https://www.dropbox.com/s/fmqhp8px8idzp ... d.zip?dl=0
  15. You should keep in mind that SAMP still offers some functions that don't exist in MTA so they probably can do this without any problem. But MTA lacks some fire functions and events.
  16. Be patient because i have to look at this myself and i have currently no time left.
  17. Just replace SWAT tank with your tank and include this vehicle in my vreload community resource, shouldn't be too hard. I have currently no time left to do this myself but there is not much more to do than this: if veh == 432 then Change to if veh == 432 or veh == 601 then
  18. I will Check this later... This shouldn't happen.
  19. No matter how you do it, it won't be precise. Ofc you could calculate the angle between the cannon and the fire but you don't know if you really hit the fire. You WILL see weird issues.
  20. How do you want to create this as long as it is impossible to retrieve if you hit the fire with water or not?
  21. If it was the update, then stay tuned. Others will report this aswell, and the devs will fix it.
  22. At least this awesome streamer worked in blue @this 8 month old eir test build and that is a big difference imho.
  23. I sent some crash dumps to the bug tracker and the devs will look into that sooner or later. Maybe you should disable vreload and see if it still crashes from time to time. The issue could be projectile or onClientRender or even matrix related. Btw. You can download the vreload update now.
  24. I am ready to push the update. -Some small issues fixed -New reload sound added to Hydra/Hunter -Reload bar added to Hydra/Hunter I am sure those crashes are not caused by my script because other people (me including) are not experiencing any crashes.
×
×
  • Create New...