-
Posts
143 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Trust aka Tiffergan
-
How to add radar areas on the custom radar script?
Trust aka Tiffergan replied to Spectre Official's topic in Scripting
If the radar area created with the createRadarArea function is not visible, you may need to add it to the rendering process. To do this, you can modify the RADAR function that draws the radar on the screen and add code to draw the radar area. You can use the dxDrawMaterialLine3D function to draw the shape of the radar area on the radar. You will need to provide the position and size of the radar area, as well as the rotation angle, which can be obtained from the getElementRotation function. -- ... --# Blips local radarAreas = getElementsByType("radararea") for k, v in ipairs(radarAreas) do local x1, y1, z1, x2, y2, z2 = getRadarAreaSize(v) local minX, minY, minZ = math.min(x1, x2), math.min(y1, y2), math.min(z1, z2) local maxX, maxY, maxZ = math.max(x1, x2), math.max(y1, y2), math.max(z1, z2) local width, height, depth = maxX - minX, maxY - minY, maxZ - minZ local cx, cy, cz = (minX + maxX) / 2, (minY + maxY) / 2, (minZ + maxZ) / 2 local rot = getElementRotation(v) dxDrawMaterialLine3D(cx - width / 2, cy - height / 2, cz, cx + width / 2, cy - height / 2, cz, rt, 2, tocolor(255, 0, 0), cx, cy, cz, rot) dxDrawMaterialLine3D(cx + width / 2, cy - height / 2, cz, cx + width / 2, cy + height / 2, cz, rt, 2, tocolor(255, 0, 0), cx, cy, cz, rot) dxDrawMaterialLine3D(cx + width / 2, cy + height / 2, cz, cx - width / 2, cy + height / 2, cz, rt, 2, tocolor(255, 0, 0), cx, cy, cz, rot) dxDrawMaterialLine3D(cx - width / 2, cy + height / 2, cz, cx - width / 2, cy - height / 2, cz, rt, 2, tocolor(255, 0, 0), cx, cy, cz, rot) end -- ... This code will render the outline of each radar area in red color on the radar. You can modify the color and thickness of the lines as needed. -
local speed = 20 local buoyancy = 1.5 local drag = 1 function swimVehicle ( ) local x, y, z = getElementPosition(vehicle) local waterZ = getWaterLevel ( x, y, z ) if waterZ and z < waterZ then setElementData(vehicle, "buoyancy", buoyancy) setElementData(vehicle, "vehicleDrag", drag) setElementData(vehicle, "centerOfMass", {0,0,-1}) setVehicleHandling(vehicle, "engineAcceleration", speed) else setElementData(vehicle, "buoyancy", 0) setElementData(vehicle, "vehicleDrag", 0) setVehicleHandling(vehicle, "engineAcceleration", 0) end end addEventHandler("onClientRender", root, swimVehicle) Please note that this is just a basic example, you would need to fine tune the values and add more functionality to make it more realistic and functional. Also, this example is for client-side script, you need to adapt it for server-side.
-
How to add radar areas on the custom radar script?
Trust aka Tiffergan replied to Spectre Official's topic in Scripting
It looks like you are using the function createRadarArea to create a radar area, but it is not appearing on your radar. To make sure that the radar area is visible, you will need to make sure that it is being added to the element list that you are iterating through in the for loop starting on the following line: for k, v in ipairs(getElementsByType("blip")) do You will want to change this to include radar areas as well, for example: for k, v in ipairs(getElementsByType("blip", "radararea")) do This will ensure that the radar areas created with createRadarArea function are included in the list of elements being drawn on the radar. -
[HELP] ADD cammand for shaders on/off for players
Trust aka Tiffergan replied to Sr.black's topic in Scripting
function enable_shaders() if not shadersEnabled then -- code to enable shaders, for example: setWeather(15) setFogDistance(50) shadersEnabled = true outputChatBox("Shaders enabled.") else outputChatBox("Shaders are already enabled.") end end function disable_shaders() if shadersEnabled then -- code to disable shaders, for example: setWeather(0) setFogDistance(200) shadersEnabled = false outputChatBox("Shaders disabled.") else outputChatBox("Shaders are already disabled.") end end This example uses a global variable shadersEnabled to keep track of whether the shaders are currently enabled or disabled. The enable_shaders() function checks if the shaders are already enabled before enabling them, and the disable_shaders() function does the same for disabling the shaders. You would also need to initialize the global variable shadersEnabled to keep track of the current state of shaders, for example: shadersEnabled = false You would then need to add a command handler to listen for the "shaders on" and "shaders off" commands: addCommandHandler("shaders", function(player, command, option) if option == "on" then enable_shaders() elseif option == "off" then disable_shaders() end end) Note that the code to actually enable and disable the shaders would depend on the specific technology you are using to implement the shaders, and in this example I provided an example of how to change the weather and fog distance, you may need to adjust that according to your needs.- 1 reply
-
- 1
-
-
Nice, I'm waiting to play
-
What is 'car uv?'
-
hello, i would like to buy a fanpage with players from mta interested in dayz server i hope this is correct section
-
Nice, by the way what is this map?
-
It's hard to say without more information about the problem. Some things you might want to check are: Make sure that the dxDrawText function is being called after the dxDrawImage function so that the text is drawn on top of the image. Verify that the tx and ty variables are being set to the correct screen coordinates before the dxDrawText call. Check the item table in the dxDrawImage call to ensure that it contains the correct image file path. Make sure that the item table is defined and containing expected values. Verify that the screenW and screenH variables are set to the correct values for the current window size. Check the output of getElementData(localPlayer, 'inv.item') or {} to ensure that it returns the expected data. Make sure that the dxDrawText function is receiving the correct arguments and that they are in the correct order. Check if there is any error message in the console. It may be helpful to add some debugging output or print statements to help you see what's happening at each step.
-
To find the relative coordinates of the listener from the point of the sound source, you can use the following steps: Calculate the distance between the listener's position and the sound source's position using the getDistanceBetweenPoints2D function. Calculate the angle between the listener's position and the sound source's position by getting the angle between the two points using math.atan2(y2-y1, x2-x1) Rotate the angle by the sound source's rotation (sound.rotZ) using math.rad(sound.rotZ) Use this angle and the distance to calculate the relative x, y, and z coordinates of the listener from the sound source using math.cos(angle)*distance for the x coordinate and math.sin(angle)*distance for the y coordinate. Use the resulting x, y, and z coordinates to position the listener on the sound source's vector. here is an example of how the relative coordinates of the listener can be calculated using the steps I outlined above local listener = {x = localPlayer.matrix:getPosition().x, y = localPlayer.matrix:getPosition().y, rotZ = localPlayer.matrix:getRotation().z} local sound = {x = -1788.82507, y = -2689.26538, z = 4.26150, rotZ = 180 + 90} local distance = getDistanceBetweenPoints2D ( sound.x, sound.y, listener.x, listener.y ) local angle = math.atan2(listener.y - sound.y, listener.x - sound.x) + math.rad(sound.rotZ) local listenerRelativeX = math.cos(angle) * distance local listenerRelativeY = math.sin(angle) * distance local listenerRelativePos = {x = sound.x + listenerRelativeX, y = sound.y + listenerRelativeY, z = listener.z} This code calculates the relative position of the listener from the sound source using the distance and angle between the listener and sound source, and the rotation of the sound source. The resulting position is stored in the listenerRelativePos variable, which contains the x, y, and z coordinates of the listener relative to the sound source. Note that this code is missing the calculation of the z coordinate, you need to add the calculation of the z coordinate based on the requirement of your game or application.
-
I jak tam po tylu latach dalej wspierasz program?
-
[Poradnik] Nauka modelowania - 3ds Max
Trust aka Tiffergan replied to Garru's topic in Polish / Polski
Przyjemne poradniki szkoda że już nie nagrywasz -
Reinstalacja MTA i GTA bo w plikach od GTA ma coś pewnie zamienionego
-
Here is an example of how you can use this function to set the level of a player's job: local player = getPlayerFromName("PlayerName") local level = 5 setElementData(player, "job level", level) This will set the player's job level to 5. You can then retrieve the data with the getElementData function. local player = getPlayerFromName("PlayerName") local level = getElementData(player, "job level") This will get the player's job level . Please note that this is just a basic example, you'll probably need to integrate this into your job system and add additional functionality such as checking for valid jobs and levels, and updating the player's job level in your database.
-
Yes, if you turn off the server while a player is still logged in, their information will be lost as it is only stored in the server's memory. To prevent this, you can use an SQL database to store the player's information permanently, as I mentioned. When a player logs in, you can retrieve their information from the database and set it as element data on the player. When the player logs out or quits, you can update their information in the database with the element data on the player. This way, even if the server is turned off, the player's information will still be saved and can be retrieved when they log in again.
-
Problem z internetem gdy wchodze do mta
Trust aka Tiffergan replied to olek1x231231312's topic in Polish / Polski
Czy tak się dzieje na każdym serwerze czy tylko 4life? -
Chodzi Ci o twoje Bipy na GPS? Czy na serwerze aby gracze mieli lepsze? Możesz napisać skrypt na GPS albo wziąć z internetu i tam w plikach zmienić blipy A jak chcesz ty sobie zmienić aby na jakimś tam serwerze mieć HD to możesz zmienić pliki w HUD.txd
-
Problem z CL02
Trust aka Tiffergan replied to Webmajster's topic in Pomoc z grą lub klientem/serwerem MTA
Reinstalacja MTA powinna pomóc bo to błąd z plikami, ewentualnie GTA SA od 0 zainstaluj -
Czy jest możliwość zmiana serialu ?
Trust aka Tiffergan replied to sisiej35's topic in Pomoc z grą lub klientem/serwerem MTA
Jak kupisz inny dysk to będzie inny serial -
Czy to jest zwykły chat z MTA czy jakiś serwer że skryptem na chat który jest inny, posiada emotikony itp?
-
Potężny błąd
Trust aka Tiffergan replied to JJoker22's topic in Pomoc z grą lub klientem/serwerem MTA
Uruchom /debugscript 3 i pokaż jakie błędy i ostrzeżenia tam Ci wyskakują w taki sposób łatwiej będzie nam Ci pomóc. -
Storing player information such as points, cash, kills, and deaths in a database, rather than in the game's internal data, can be a more suitable option if you want to create a ranking panel or if you have performance concerns. Using an SQL database to store player information, such as MySQL, allows you to easily retrieve and update player information, as well as run more complex queries and create more advanced systems. It also allows you to store this information even if the server restarts or the player logs out, you can use the SQL queries to update the data even when the player is not online. One way to implement this in your gamemode would be to use the SQLite or MySQL library for Lua that is provided by the MTA community to perform SQL queries on a local or remote database. You can use the queries such as SELECT, UPDATE, INSERT and DELETE to get and manipulate the data. When a player logs in, you would use an SQL SELECT query to retrieve their information from the database and set it as element data on the player. When the player logs out or quits, you would use an SQL UPDATE query to update their information in the database with the element data on the player. It's important to note that, depending on the amount of players and how frequently the data is updated, this could put a lot of strain on the database and might slow down the server. To avoid this, it's good practice to use connection pooling, prepared statements and queries optimization. Keep in mind that the method you're currently using can work, but it's limited by the fact that the data is only stored for as long as the server is running and the player is logged in. @Rougue90
-
So did you do it yourself ?
-
This error is likely being caused by one of the following: exports["P23-Core"] is nil or not a valid table. This means that the table being accessed does not exist, or it does not have a findPlayer function. The findPlayer function is not functioning correctly. This could be due to an error in the implementation of the function, or it could be due to incorrect arguments being passed to the function. To fix the error, you will need to locate and correct the root cause of the issue. This will likely involve debugging the findPlayer function and/or the code that is calling it.
-
https://wiki.multitheftauto.com/wiki/SetPedWalkingStyle
