-
Posts
635 -
Joined
-
Days Won
8
Posts posted by srslyyyy
-
-
I assume both annotations and go to definition (particularly variable, because you can already go to function definition) works for Sublime Text 4 as well?
- 1
-
Nie zajmujemy się poszczególnymi serwerami, toteż aby odzyskać dostęp musisz zgłosić się do administracji danego serwera.
-
8 hours ago, Rom4n said:
Grałem bardzo dawno na koncie i przelazłem na innego kompa nie pamietam maila do forum i nie wiem czy mialem podpietego discorda
Zapewne odnosisz się do danego serwera, musiałbyś się zgłosić na ichniejszym forum.
-
On 09/07/2023 at 00:25, RekZ said:
the Russians and Brazilians go to the server and kick out the players with that message and I don't have any triggerServerEvent where the player is kicked out... I don't understand how it could be a security flaw in my server that allows a player to come in and kick everyone out just like that. If it's a security issue, it should be with the administration panel, not my server. The problem is that when someone comes to seek help on the forum, all they find is people judging their comments and others downplaying the situation, nothing new.
Make sure to update all default (and community) resources. Keeping them outdated could lead to such scenarios, where they could make use of incorrectly written logic.
Disable access to load and loadstring in ACL, unless you have certain reason to keep it enabled (latest MTA builds have it disabled by default).
<right name="function.loadstring" access="false"/> <right name="function.load" access="false"/>
You could take a look at Script security article, which i've recently updated.
Also, there's no such anti-cheat which would protect you from vulnerable Lua code running on your server, so blaming it in first place isn't reasonable - which most of people nowadays shamelessly do. Including ungratefulness towards AC team, which provided nearly cheat-free experience for a few good years. -
Merry xmas and happy new year
- 2
-
On 02/08/2022 at 18:58, PanMaszyna said:
Siema guys. Ktoś mądry opatentował już dobre skalowanie pod 4K w dół?Chodzi o DOBRE skalowanie, moje niestety nie sprawdza się dobrze, owszem zachowuje proporcje względem zmniejszania ekranu ale jednak czcionka jest za małą już na FullHD.
Lepszego raczej nie znajdziesz.- 1
-
4 hours ago, Swimer said:
I need to get the result of a server function from an event handler.
local plTeam = getPlayerTeam(localPlayer) if plTeam then if isPlayerInTeam(plr, plTeam) then local friend = getPlayerFriend(plr) -- Execute server-side function "getPlayerFriend(player)" text = friend.." ["..id.."]" end end
Try this, but carefully read full page. Might require some changes though.
https://wiki.multitheftauto.com/wiki/CallServerFunction -
20 hours ago, MTA.Castiel said:
Hi there. Below is a simple client-side code that allows us to play a song by command. For our stopMusic function I've made an array of setTimer's to bring down the volume before stopping the song completely, thus achieving a fadeout effect. It works alright but i feel like there must be a much cleaner or simplified way of doing this: Which would be the best?
function playMusic() song = playSound("music/track_05.mp3", true) setSoundVolume(song, 1) end addCommandHandler("pmusic", playMusic) function stopMusic() setTimer(function() if isElement(song) then setSoundVolume(song, 0.95) end end, 100, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.90) end end, 200, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.85) end end, 300, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.80) end end, 400, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.75) end end, 500, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.70) end end, 600, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.65) end end, 700, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.60) end end, 800, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.55) end end, 900, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.50) end end, 1000, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.45) end end, 1100, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.40) end end, 1200, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.35) end end, 1300, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.30) end end, 1400, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.25) end end, 1500, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.20) end end, 1600, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.15) end end, 1700, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.10) end end, 1800, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.09) end end, 1900, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.08) end end, 2000, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.07) end end, 2100, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.06) end end, 2200, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.05) end end, 2300, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.04) end end, 2400, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.03) end end, 2500, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.02) end end, 2600, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0.01) end end, 2700, 1) setTimer(function() if isElement(song) then setSoundVolume(song, 0) end end, 2800, 1) setTimer(function() if isElement(song) then --Destroy the sound element destroyElement(song) end end, 2900, 1) end addCommandHandler("smusic", stopMusic)
You can use https://wiki.multitheftauto.com/wiki/Animate
In order to smoothly change volume.- 1
-
2 hours ago, MagCiastko said:
Witam ostatnio grałem na serwerze mta nagle coś mi wyrzuciło jak się okazało otrzymałem globalnego bana na AC mimo że nie miałem żadnych cheatów po godzinie wszedłem na serwer i znowu dostałem globalnego bana tym razem na zawsze prosze o usunięcie blokady
Napisz tutaj - https://forum.multitheftauto.com/forum/180-ban-appeals/
Tylko po angielsku.
-
On 16/01/2022 at 05:57, Kelvenbrryan said:
I'm an apprentice bro how can I do this please
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:
-
11 hours ago, ModerNCliX said:
Oh, ty
I am looking how to enable this, I tried to use the old freeroam resources that came with the mta files, but some cause errors
I appreciate any help
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. -
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)
-
Topic moved for better results.
-
Closed upon request.
-
If you mean command then you could use optional argument for addCommandHandler.
bool addCommandHandler ( string commandName, function handlerFunction [, bool restricted = false, bool caseSensitive = true ] )
Quoterestricted: Specify whether or not this command should be restricted by default. Use this on commands that should be inaccessible to everyone as default except special users specified in the ACL (Access Control List). This is to make sure admin commands such as ie. 'punish' won't be available to everyone if a server administrator forgets masking it in ACL. Make sure to add the command to your ACL under the proper group for it to be usefull (i.e <right name="command.killEveryone" access="true"></right>). This argument defaults to false if nothing is specified.
-
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 -
Hi
Your topic has been moved to Portuguese scripting section for better results. -
From what i can see the or operator is missing here.
if teamName == "~STAFF" isObjectInACLGroup("user."..account, aclGetGroup("Admin")) then
It should looks like this:
if teamName == "~STAFF" or isObjectInACLGroup("user."..account, aclGetGroup("Admin")) then
Also you need one more end which will close function scope.
-
On 14/07/2021 at 18:02, MohammedX said:
I have a question @IIYAMA do i have to work on resolution of 1920x1080? or on any resolution. cuz i prefer 1280x720 most of it and some people say that u should work on 1920x1080 resolution that is better?
maybe my question is stupid....or idk i just asking
Not really. I am using this method on 1360x768.
- 1
-
17 hours ago, Ryuto said:
Hello, I open this post to ask if it is possible to increase or decrease the damage caused by an explosion and what functions I can use to achieve it.
You would need to use cancelEvent() (to cancel default behaviour) in onClientVehicleDamage and write your own damage system via this event.
-
-
13 hours ago, oggygod said:
I have a question
What are the normal values for cpu usage for client?
For example, for something like this(text above npc head): Screen
Now 2.03% is used there but how good is that?
Maybe I can reduce the load in some way or are these normal numbers?
function testcpu() local x, y, z = getCameraMatrix() local dimension = getElementDimension(localPlayer) local px, py, pz = getElementPosition(getElementByID("ped1")) local distance = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if distance <= 7 then local sx, sy = getScreenFromWorldPosition(px, py, pz + 1.2) if sx and sy then dxDrawText("Unknown", sx, sy, sx, sy, tocolor(3, 169, 252, 255), 2.02, "default-bold", "center", "center", false, false, false, false, false) end end end addEventHandler("onClientRender", getRootElement(), testcpu)
If you wanna keep script in this state, i will explain what could be done better. Start off by:
Saving an function call in:local dimension = getElementDimension(localPlayer)
Currently, you are returning it every frame, while you could save it in main scope and avoid calling it. By using onClientElementDimensionChange to store localPlayer's current dimension.
local dimension = 0 function onClientElementDimensionChange(_, newDimension) dimension = newDimension end addEventHandler("onClientElementDimensionChange", localPlayer, onClientElementDimensionChange)
Saving an another function call:
local px, py, pz = getElementPosition(getElementByID("ped1"))
I'm assuming that custom element is created on script init, otherwise you would need to update it at the time it creates.
-- Main scope local myPed = getElementByID("ped1") -- Render scope local px, py, pz = getElementPosition(myPed)
For next step, you could use custom implementation of getDistanceBetweenPoints3D which is faster from MTA (thanks @Sarrum)
local function getDistance3D(pFirstX, pFirstY, pFirstZ, pSecondX, pSecondY, pSecondZ) pFirstX, pFirstY, pFirstZ = pFirstX - pSecondX, pFirstY - pSecondY, pFirstZ - pSecondZ return (pFirstX * pFirstX + pFirstY * pFirstY + pFirstZ * pFirstZ) ^ 0.5 end
Another thing which most of scripters forget about is using tocolor in render, even if color doesn't change...
tocolor(3, 169, 252, 255) -- notice () - a function call which returns same color every frame
The solution will be to save it in local variable in main scope and later use it.
-- Main scope local textColor = tocolor(3, 169, 252, 255) -- Render scope dxDrawText("Unknown", sx, sy, sx, sy, textColor, 2.02, "default-bold", "center", "center", false, false, false, false, false)
If color isn't static you could use, for example events or timers which will be ideal way to update it.
Other than that, you might use onClientElementStreamIn/onClientElementStreamOut to add/remove handler when ped appears or disappears from stream zone, as mentioned above by Dutchman101.
- 2
-
On 10/06/2021 at 21:27, Kelly003 said:
Hi, how to do something like this when the checkbox is selected in the login panel, it saves the data (login and password)
There's a guide for this -
See How to add "remember me" functionality. You shouldn't store password on client-side, even encoded.
-
2 hours ago, Derbo said:
Can't figure out how to use it.
Can you complete the script for me please?
We are here to help, not to do job for you.
https://wiki.multitheftauto.com/wiki/OnClientKey
See examples to understand how this event works.
Lua Language Server - Definition files
in Tutorials
Posted
After some testing i could just say: wow. Just for the sole fact of updated syntax this is amazing (although there is mistakes to be found), and the latter is just spicy addition.