-
Posts
6,056 -
Joined
-
Last visited
-
Days Won
208
Posts posted by IIYAMA
-
-
On 26/05/2024 at 15:47, DanHR said:
fileClose(localFile)
Just some context why your code is not working as intended.
You are currently closing the file after running the first command. Do this on onClientResourceStop + resourceRoot.
QuotefileWrite(localFile, tostring(i)..", "..tostring(voiceType)..", "..tostring(voiceName)..";")
- Don't forget to add newlines with \n.
- After every command run fileFlush, so that the file writes are actually written to the file.
- 1
-
9 hours ago, Avir14 said:
this will kick player if he is cheating ?
No, this will do the opposite.
disableac = disable specific detections
-
3 hours ago, Gaimo said:
what is the function to obtain the size of an object?
This is the function: https://wiki.multitheftauto.com/wiki/GetElementBoundingBox
(box size only)
The function was missing on the Clientside element section, but now it is added.
- 1
-
18 minutes ago, 31cmTrueDamage said:
Thank you, sorry to bother, but what recommendations do you have to work better in multiplayer,
For multiplayer you have to store data for each player. And one of the ways to do that is using tables.
Here some basic functions you could use.
- Init the storage first: initPlayerData (onPlayerJoin)
- And after that you can set and get data from the table, for each player: getPlayerData, setPlayerData
- When a player disconnects: deletePlayerData (onPlayerQuit)
---@type {[userdata]: {[string]: unknown}|nil} local playerDataCollection = {} ---@param player userdata ---@param key string ---@return unknown|nil function getPlayerData(player, key) local playerData = playerDataCollection[player] if not playerData then return end return playerData[key] end ---@param player userdata ---@param key string ---@param value any function setPlayerData(player, key, value) local playerData = playerDataCollection[player] if not playerData then return end playerData[key] = value end --- Create a storage table for data of a specific player ---@param player userdata function initPlayerData(player) if playerDataCollection[player] then return end playerDataCollection[player] = {} end --- Remove all player data and remove it's storage table ---@param player userdata function deletePlayerData(player) if not playerDataCollection[player] then return end playerDataCollection[player] = nil end
-
17 hours ago, 31cmTrueDamage said:
so i guess i am not getting the player position correctly maybe? not sure.
Your initial code looked fine except for a duplicated message when you are in the marker:
Stage time:
Stage finished! Time:
Here you have an alternative version + debug lines so that you can validate what is wrong.
View in debug console: /debugscript 3
Also keep in mind that this code will not work very good in multiplayer, as startTime, startMarker and finishMarker are shared between all players.
You can ignore the ---@ annotations, those are helping me to automatic validate your code. (and perhaps help you to improve readability)
---------- -- Add to top of script (local's making sure other scripts can't modify these values by accident) ---@type integer local startTime = 0 ---@type userdata|nil local startMarker ---@type userdata|nil local finishMarker --------- -- ... -- --------- ---@param player userdata function checkStageProgress(player) iprint("Validate player", player, isElement(player) and getElementType(player)) if not isElement(startMarker) or not isElement(finishMarker) then iprint("Not startMarker:", isElement(startMarker) and "It exist" or "does not exist", "or not finishMarker:", isElement(finishMarker) and "It exist" or "does not exist") return end if not raceInProgress then iprint("Race is not in progress") local startX, startY, startZ = getElementPosition(startMarker) local playerX, playerY, playerZ = getElementPosition(player) local distanceToStart = getDistanceBetweenPoints2D(startX, startY, playerX, playerY) if distanceToStart <= 3 then raceInProgress = true startTime = getTickCount() -- Start counting time outputChatBox("Stage started!", player) end return end ------------------------- -- Race is in progress -- local elapsedTime = math.floor((getTickCount() - startTime) / 1000) if isElementWithinMarker(player, finishMarker) then outputChatBox("Stage finished! Time: " .. elapsedTime .. " seconds.", player) raceInProgress = false return end ----------------------------- -- Player is not in marker -- outputChatBox("Stage time: " .. elapsedTime .. " seconds.", player) end
-
On 09/04/2024 at 13:12, Ex_Asfh said:
What Your IDE Name For Lua Code ?
Visual Studio Code (for everything).
While I must say that I definitely love Sublime it's responsiveness, but it was (for me) not enough to change editors.
-
On 11/03/2024 at 01:14, Snakegold said:
ERROR: Client "playername" triggered serverside event onPlayerDamage, but event is not marked as remotely triggerable
- Double check if the serverside file is running and init as serverside.
- Do not enable remote for native events. This is a security risk.
- Use the predefined client variable for remote triggers, else cheaters can kill a whole server instantly.
iprint(triggerClientEvent and "serverside" or "clientside") -- inspect if the file is running serverside addEvent("onPlayerDamage", false) -- disable remote function handlePlayerDamage(attacker, weapon, bodypart, loss) if client ~= source then return end local victim = client triggerEvent("onPlayerDamage", victim, attacker, weapon, bodypart, loss) -- emulate the (client) cancelled onPlayerDamage event if getElementHealth(victim) > 0 then setElementHealth(victim, getElementHealth(victim) - loss) if getElementHealth(victim) <= 0 then setElementData(victim, "isDead", true) killPed(victim) end end end addEvent("onCustomPlayerDamage", true) addEventHandler("onCustomPlayerDamage", root, handlePlayerDamage) function isPlayerDead(player) return getElementData(player, "isDead") or false end
function onClientPlayerDamage(attacker, weapon, bodypart, loss) if attacker and getElementType(attacker) == "player" then triggerServerEvent("onCustomPlayerDamage", localPlayer, attacker, weapon, bodypart, loss) cancelEvent() end end addEventHandler("onClientPlayerDamage", root, onClientPlayerDamage)
-
7 hours ago, Snakegold said:
I want to ensure that only one player dies in such situations.
Technically it is possible, but it will only work as intended when the latency is very low (< 60 ping) and stable internet (no packet loss).
How it technically works is that the server is used as mediator for all the damage. When a player it's health is 0, all future damage done by this player is ignored.
But keep in mind that this will look very weird when the latency is too high. (unplayable)
Some basics:
Clientside
Serverside
-
2 hours ago, Ryan167 said:
how could I make the marker only trigger on dimension 11?
If the parameter matchingDimension contains the value true, the marker is hit in the same dimension.
2 hours ago, Ryan167 said:What I'm trying to do is have a marker in dimension 11 and when the player joins the marker the player can't use a jetpack (it works but it stays working even outside the marker) and the weapons disabled, which works fine.
Instead of setting a timer. Which currently is being created infinity > crashing the server at a given point.
Do the following:
When giving a jetpack, check if the player is inside of the marker. Based on that, give the Jetpack yes / no.
-- Making the marker find able inside of another resource local antiJetpack = createElement ( "antiJetpackType", "antiJetpackID" ) local marker = createMarker ( 0, 0, 0, "cylinder", 1.5, 255, 255, 0, 170 ) setElementParent(marker, antiJetpack)
(Other resource)
local parent = getElementByID ("antiJetpackID") if not parent then return end local marker = getElementChildren ( parent )[1] local status = isElementWithinMarker ( thePlayer, marker )
https://wiki.multitheftauto.com/wiki/IsElementWithinMarker
-
23 hours ago, RandomRambo said:
and one more thing...where I can download mta 1.6n?Cus it says I need it to join the server on mta-1.6.0-unstable-7976-net41DA build on which it works...
Can't you just copy your Program Files (x86)\MTA San Andreas 1.6\server to the server? (maybe I am missing something, but a windows server should be able to start up windows stuff)
-
3 hours ago, pixel77 said:
data[1] and data[2] are numbers.
For example: inUseData[12][5] = true
The client is clicking on a dxDraw button, that is rendered on the 3D World.
Then the code looks fine. Unless the numbers are a mixture of numbers and strings. 123 vs "123"
16 hours ago, pixel77 said:So they can run the "--some more code here to do things" in the same time, and I don't want to allow this.
In theory it shouldn't be possible because this function is ran single threaded. There will always be one that is first. The whole function chain-call should have been ended before a new call can be made.
The following should be finished before the root function can be called again.
16 hours ago, pixel77 said:--some more code here to do things
- 1
-
3 hours ago, pixel77 said:
data[1]
What is inside of data[1] and data[2]? (to be more specific, what type is inside: table, string, number etc.)
And what are you clicking on?
-
5 hours ago, FernandoMTA said:
I opened a merge request to add two little client function defs that were missing
Merged!
- 1
-
-
3 hours ago, RandomRambo said:
Config changed after I installed latest build so config isn't the real problem.
It can be an issue if you used the config of an older build.
3 hours ago, RandomRambo said:It works perfectly on 1.5.9 builds,but on 1.6 it just restarts all time and no errors in console
You checked the logs as well? (sometimes not all errors are visible in the console)
And what kind of server are you running? Windows or linux?
If it is Windows, you should be able to copy over your local server and try that one.
If Linux, you might consider starting it up with sudo, so that it does not run in to any permission issues while creating/moving the initial files.
-
On 17/02/2024 at 21:20, RandomRambo said:
So,what is the problem that my server doesn't start on stable 1.6 build?:(
Is this server installed with MTA or did you download the stable version separately?
Things to check/do:- Check your virus scan, maybe some server files have been quarantined.
- Reset the config, maybe it is missing something: https://github.com/multitheftauto/mtasa-blue/blob/master/Server/mods/deathmatch/mtaserver.conf.template
- You might consider, just reinstall MTA competently.
-
5 hours ago, pixel77 said:
Any other methods?
A hard function skip maybe, just to figure out if it is actually the models.
addDebugHook( "preFunction", function ( ) return "skip" end, {"engineLoadCOL", "engineReplaceCOL", "engineLoadTXD", "engineImportTXD", "engineLoadDFF", "engineReplaceModel"})
(if possible run the hook on a resource with higher download priority)
If that is the issue, then rewrite the resources so that the models are loaded slower. For example load a model every X frame(s).
-
1 hour ago, pixel77 said:
Because it happens to more players, the problem comes from a resource on the host.
You could start with disabling all models, number 1 in causing cashes.
-
6 hours ago, FreezyMTA said:
When we log in manually using this URL, it gives a timed out error.
Is the web panel accessible? (and other resources)
-
12 hours ago, sirrjohn said:
if health >= loss then
Not sure but, would the > operator not make more sense?
if health > loss then --- ... else setElementExtraHealth(source, 0) -- clean dead status (not sure if this is a good idea) end
-
23 minutes ago, srslyyyy said:
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?
Yes, that is indeed the case.
(Sublime)
- 1
-
1 hour ago, aRRRtem said:
So my question is how can I track other client`s software to block players with rippers?
I believe you should first understand the underlying problem.
1 hour ago, aRRRtem said:steal my game client files
They are not stealing your files. You are sending those files to them. When they host your files, this is where they are using your files without permission.
Quotewhere they use your files without permission
This is where I recommend to solve your problem. They are using your files because they are appealing to be used. If you make them less appealing, for example by adding branding to them, this will become advertisement for your server (in their server).
-
On 07/02/2024 at 21:24, Hiding said:
so I want my arrow marker to be visible even if there's an object front of it that obscures it.
You could try to use the dxDrawPrimitive3D function to mimic the marker and set postGUI to true, just keep in mind the downsides of postGUI.
© MTA wiki
- 1
-
4 hours ago, FreezyMTA said:
I gave HTTP authorization from ACL and meta.xml, but it still does not work.
You probably already did the following, but just checking.
What happens if you visit those URL's manually? (maybe it is asking for a login authorisation)
How To Add Bind M
in Scripting
Posted
You can bind keys with the following command. You can also use the bind key tab interface for that (main menu).
https://wiki.multitheftauto.com/wiki/Client_Commands#bind
/bind m down <command>
But I have no idea to which command your m key was bound to. Some more context is required.