Jump to content

Trust aka Tiffergan

Members
  • Posts

    132
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Trust aka Tiffergan

  1. here is a video on youtube how to make this
  2. first gets the cursor position, the camera matrix, and the vehicle position. Then, it calculates the sticker's X position by subtracting the camera's X translation from the cursor's X position, and adding the vehicle's X position. Similarly, it calculates the sticker's Y position by subtracting the camera's Y translation from the cursor's Y position, and adding the vehicle's Y position. local cursorX, cursorY = getCursorPosition() local cameraMatrix = getCameraMatrix() local vehiclePosition = getElementPosition(vehicle) local stickerX = cursorX * 1024 - cameraMatrix[12] + vehiclePosition[0] local stickerY = cursorY * 1024 - cameraMatrix[13] + vehiclePosition[1] stickers[selectedStickerID][1] = stickerX stickers[selectedStickerID][2] = stickerY
  3. Hello, I have problem using script radargen I got map from my server but the problem is I have a green shaders on my server and for example bonecountry, area51 are green and my map from radargen is original like from gta sa so does someone know how I can get output radar with my shaders?
  4. can you show errors from 'debugscript 3' ?
  5. I followed your guide exactly, but when I try to start the model, I get an error. " Resource is loaded, but has errors (Couldn't find file files/lod_conhoos1.txd for resource files)" How can I fix this?
  6. Create a custom event in your script that will trigger the NPC driving the car. Within this event, you will use the setElementData function to set a custom server-side variable that will keep track of the NPC's driving state. You will then create another custom event that will be triggered regularly (for example, using a timer) to update the NPC's driving state based on the value of the custom server-side variable set in step 2. In this second event, you will use the setPedControlState function to set the NPC's driving state. This way, you will be able to create a server-side setPedControlState that allows an NPC to drive a car in MTA.
  7. To create your own shaders in MTA, you will need to have a good understanding of computer graphics and programming, as well as the DirectX graphics library. A good starting point would be to familiarize yourself with the basics of shaders, such as the different types of shaders (vertex shaders, pixel shaders, etc.), how they work, and the syntax of the DirectX Shader Model language. The following resources may be helpful in learning how to create shaders in MTA: The official MTA wiki (https://wiki.mtasa.com/wiki/Main_Page) has a section on shaders and provides information on how to use shaders in MTA. The official MTA forums (https://forum.mtasa.com/) have a section on scripting, where you can find answers to questions and see examples of shaders created by other users. YouTube tutorials and online courses on computer graphics and DirectX may also be helpful in learning how to create shaders. Keep in mind that creating shaders requires a good understanding of programming and graphics, so it may take some time and effort to become proficient. But with practice and determination, you can create your own custom shaders for use in MTA. Here is an example of a simple pixel shader that applies a grayscale effect to the game world float4 PSMain(float2 texCoord : TEXCOORD) : COLOR { float4 color = tex2D(DiffuseMap, texCoord); float intensity = (color.r + color.g + color.b) / 3.0; color.r = intensity; color.g = intensity; color.b = intensity; return color; } technique Grayscale { pass Pass1 { PixelShader = compile ps_2_0 PSMain(); } } This shader takes the texture coordinate data from the game world and applies a grayscale effect to it. The PSMain function calculates the average intensity of the color data and sets the red, green, and blue channels to that value, creating a grayscale image. The Grayscale technique specifies that this shader should be used as a pixel shader, and the Pass1 pass indicates that there is only one pass required to apply this effect. This is just a simple example to give you an idea of what a shader in MTA might look like. More complex shaders can be created by using additional variables, calculations, and techniques.
  8. You can use the "setWeaponProperty" function to set the recoil values for a specific weapon. For example, you can use the following code to set the recoil for an AK-47: setWeaponProperty("AK-47", "poor", "recoil", 0.5) setWeaponProperty("AK-47", "good", "recoil", 0.3) The first argument is the weapon name, the second argument is the skill level, and the third and fourth arguments are the property and value, respectively. The skill level can be "poor", "std", "pro", or "special", and the property can be one of the available weapon properties, such as "recoil", "spread", "accuracy", etc. The value is a number that represents the intensity of the property. You can adjust the values to create the desired recoil behavior for the weapon. Also You can write custom code that modifies the behavior of the weapon's recoil in real-time, based on various factors such as the player's movement, the weapon's condition, or any other variables you choose to include. For example, you could write a script that makes the recoil stronger when the player is moving and weaker when the player is standing still. The possibilities are endless, and the custom recoil behavior can be tailored to meet your specific needs.
  9. local myButton = createButton(0.5, 0.5, 0.1, 0.1, "Click me!", true) addEventHandler("onClientGUIClick", myButton, function() outputChatBox("Button clicked!") end) In this example, the script creates a GUI button and adds an event handler for the onClientGUIClick event. When the button is clicked, the event handler is triggered, and this refers to the button element that was clicked. The output message will display "Button clicked!" in the chatbox.
  10. It's hard for me to understand what you mean, please describe your error better.
  11. To solve the issue you are facing, you need to debug the problem to determine what is causing the players to get stuck in the ground. Here are some steps that you can follow to debug the issue: Check the logs: Look at the server logs to see if there are any error messages that could be related to the issue. Isolate the problem: Try to isolate the problem by disabling other resources one by one until you find the resource that is causing the issue. Reproduce the issue: Try to reproduce the issue in a test environment to see if you can find any patterns or clues as to what is causing the problem. Check the code: If you have access to the source code, check for any errors or issues in the code that could be causing the problem.
  12. The last three arguments of the attachElementToBone function specify the rotation of the element in relation to the bone it's being attached to. The values are for the X, Y, and Z axes, respectively. To make the wheelbarrow appear normal, you'll need to adjust these values to get the desired orientation. A common approach to determining the correct values for these arguments is to use trial and error. You can make small adjustments to the values until the wheelbarrow appears to be in the desired orientation. Keep in mind that the coordinate system used in 3D graphics can be different from the one you're used to, so it may take some time to get the hang of it.
  13. In MTA, when a script is attached to an object, that object is considered the "source". The "root" element refers to the highest level parent object of the source. For example, if a script is attached to a vehicle, then the source would be the vehicle and the root would be the game world. "This" refers to the object that the script is attached to, which is equivalent to the "source". "SourceResource" refers to the resource that the script is part of. Resources are collections of files and scripts that define a specific aspect of the game, such as a custom game mode or a custom vehicle. "SourceResourceRoot" refers to the root directory of the resource that the script is part of. "Client" refers to the client-side script that is running on a player's computer. This is opposed to a server-side script, which runs on the game server. In the context of AddEventHandler, these elements can be used to specify the object that the event handler is attached to. For example: addEventHandler("onPlayerJoin", root, function() outputChatBox("Welcome to the server!") end) In this example, the event handler is attached to the root element, meaning that it will trigger for every player that joins the server. The function passed to AddEventHandler will be called, displaying a message in the chat for each player that joins.
  14. 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.
  15. 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.
  16. 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.
  17. 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.
  18. hello, i would like to buy a fanpage with players from mta interested in dayz server i hope this is correct section
  19. 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.
  20. 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.
×
×
  • Create New...