Jump to content

srslyyyy

Scripting Moderators
  • Posts

    629
  • Joined

  • Days Won

    7

srslyyyy last won the day on June 24 2021

srslyyyy had the most liked content!

Member Title

  • Polish Section Moderator & Scripting Section Moderator

Details

  • Location
    Poland

Recent Profile Visitors

6,204 profile views

srslyyyy's Achievements

Crime Partner

Crime Partner (30/54)

188

Reputation

  1. See post above. Sync settings are optional, but recommended when setting more than one data at once. Hit me up at our Discord in one of scripting help channels, in case of any questions (feel free to @ me there in case of custom data). I'm more active there than on forums.
  2. Try this, but carefully read full page. Might require some changes though. https://wiki.multitheftauto.com/wiki/CallServerFunction
  3. You can use https://wiki.multitheftauto.com/wiki/Animate In order to smoothly change volume.
  4. Napisz tutaj - https://forum.multitheftauto.com/forum/180-ban-appeals/ Tylko po angielsku.
  5. I haven't tested it. However i'd say that the most important thing during data syncing (client <-> server communication) is how often you do that. Whilst receivers being the less matter. Of course i might be totally wrong, so anyone is free to correct me up. At the time when i've learned about buffer & batch, there was no such thing as element data subscription. My server struggled to handle players, i looked for a way to optimise it. The only thing i did back then was implementing delay for continously called (player/vehicle damage) events (so called buffer), and batch for server-side data set. Once that was made, server could actually relief. Unlike to many others, it was PvP based (heavily customised), in a small game zone - it was a great experience to learn from.
  6. New year, new custom data B) On my GH there is new branch called dev. However the changes aren't backwards compatible, and some of the previous features are missing (temporarily, private data & getElementsByKey). I am also remaking documentation, which would be available only on GitHub repository wiki (as soon as i finish it). It might take a while since i'm still busy, code was released earlier in order to not collect dust. Once documentation is completed, dev branch will be merged into main. Some of changes: - Data handlers are now shared (can be used server-side). - Data handlers now pass parameters in table instead separately. - Data handlers now require only function to execute, other conditions are optional. - Syntax become way simpler, you don't need to type everything in order to use batch/buffer. - setCustomData allows you to pass extra data to data handler. - Code is way more readable. -- New syntax local dataKey = "dataKey" local dataValue = "dataValue" local syncSettings = { batchSync = "queue_player_spawn", -- name of batch queue someDataYouWantToPass = "testData" -- this will be forwarded to data handler } setCustomData(source, dataKey, dataValue, "synced", syncSettings) -- & Expanded data handlers function onClientUpdateData(...) local handlerData = ... local playerElement = handlerData.dataHolder local dataKey = handlerData.dataKey local dataValue = handlerData.dataValue iprint(playerElement, dataKey, dataValue, handlerData) end addDataHandler({ --allowedElements = {"player"}, -- allowed element types --allowedKeys = {"playerData"}, -- allowed keys --allowedEvents = {"someEvent"}, -- allowed events --localPlayerOnly = true, -- checks if element is equal to localPlayer initially handlerFunction = onClientUpdateData, -- function which will be executed; this is one and only requirement })
  7. function onClientPlayerDamage(pAttacker, pDamage, pBodypart) local localAttacker = pAttacker == localPlayer if not localAttacker then return false end -- do trigger event to server, preferrably do some check if victim ~= localPlayer; victim in this case is 'source' (without ') end addEventHandler("onClientPlayerDamage", root, onClientPlayerDamage) Note that i won't do everything for you, for next part please read:
  8. Perhaps freeroam/fr_client.lua (line 60) For the next time please use Find in files feature, which should be available in any decent code editor. It's CTRL + SHIFT + F for Sublime Text.
  9. Hit markers are probably based off attacker sync, use onClientPlayerDamage event (bind it to root), check if attacker equal to localPlayer, and then kill player if required (triggerServerEvent, and kill player server-side)
  10. Topic moved for better results.
  11. If you mean command then you could use optional argument for addCommandHandler. bool addCommandHandler ( string commandName, function handlerFunction [, bool restricted = false, bool caseSensitive = true ] )
  12. As long as it have collision it should be retrievable with https://wiki.multitheftauto.com/wiki/OnClientVehicleCollision With either hitElement or model parameter. However i think that's not a case for stinger - which you are trying to do i guess? Have a look at this resource which might help you: https://community.multitheftauto.com/index.php?p=resources&s=details&id=125
  13. Hi Your topic has been moved to Portuguese scripting section for better results.
×
×
  • Create New...