Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/02/20 in all areas

  1. local aberto = false function abrircelular(thePlayer) if aberto == false then aberto = true setPedAnimation(thePlayer, "ped", "phone_out", -1, false, false, false, false) elseif aberto == true then setPedAnimation(thePlayer, "ped", "phone_in", -1, false, false, false, false) aberto = false end end function abrircelular2(theplayer) bindKey ( thePlayer, "F1", "down", abrircelular ) end addCommandHandler ( "celular", abrircelular2 ) Obs: pode ter ficado zoado porque fiz pelo celular e se for renderizar algo passe isso para client-side, pois iria facilitar pra você.
    2 points
  2. Só lembrando o variável aberto deverá ser dado como tabela por ser do lado servidor, se não, essa variável ficará global. -- Server-side local aberto = {} function abrircelular (thePlayer) if not aberto[thePlayer] then aberto[thePlayer] = true setPedAnimation(thePlayer, "ped", "phone_in", -1, false, false, false, false) --/> Atender elseif aberto[thePlayer] then setPedAnimation(thePlayer, "ped", "phone_out", -1, false, false, false, false) --/> Desligar aberto[thePlayer] = nil end end function abrircelular2 (thePlayer) bindKey ( thePlayer, "F1", "down", abrircelular ) end addCommandHandler ( "celular", abrircelular2 ) E colocar isto ao lado do client-side, precisará fazer alterações : -- Client-Side local aberto = false function abrircelular () if aberto == false then aberto = true setPedAnimation(localPlayer, "ped", "phone_in", -1, false, false, false, false) --/> Atender Celular elseif aberto == true then setPedAnimation(localPlayer, "ped", "phone_out", -1, false, false, false, false) --/> Guardar Celular aberto = false end end function abrircelular2 () bindKey ( "F1", "down", abrircelular ) end addCommandHandler ( "celular", abrircelular2 )
    1 point
  3. :للفايدة معلومة ممكن كثير مايعرفونها 1.5.7 لكن بعد في تحديث تم إضافة فنكشن clearChatBox https://wiki.multitheftauto.com/wiki/ClearChatBox الفنكشن يمسح الشات مسح كأنك توك داخل مو مثل الطريقة القديمة إضافة أكثر من شات من بنفس الوقت
    1 point
  4. Felicitări pentru faptul că ai decis să împărtășești această resursă pentru întreaga comunitate românească. Cu siguranță există și vor exista persoane care se vor bucura de existența acestei resurse și o vor folosi pentru a-și întregi server-ul. ? Singurul lucru pe care aș dori să ți-l sugerez este să folosești portalul de resurse oficial și integrat al MTA deoarece îți va ușura atât ție munca legată de actualizarea și întreținerea resursei (portalul îți permite să ai o evidență asupra versiunilor încărcate, să primești comentarii, încarci poze și multe altele), cât și celor care vor să o descarce deoarece vor avea certitudinea că ceea ce descarcă este legitim. Pe lângă acest considerent, mult mai multe persoane vor face uz de resursa ta deoarece sunt mulți care frecventează portalul, însă această secțiune nu. Poți accesa portalul prin acest link: https://community.multitheftauto.com/ Rămâne, în orice caz, la aprecierea ta cum dorești să procedezi și indiferent de cum alegi, continuă tot așa pentru că ceea ce faci este apreciat.
    1 point
  5. Introduction Modding is a term used when modifying components, files and what not, in this particular case modifying game installation files in order to achieve unique results not seen in the vanilla game. GTA:SA is 3D era, where modding the game requires special 3D packages. Older games such as GTA:II uses a 2D engine, which means that modding the game was commonly done with image editing applications. We will cover some aspects of modding game textures and models. This guide intends on introducing those inexperienced with modding and 3D as a whole, on how to obtain 3D software and their recommended tools. It also introduces ways to import and export models, basic workflows for 3ds Max, texturing and creating models. TOC 3D packages, helpful tools and how to obtain them Extracting game assets How each type of game model works Limitations - MTA vs GTA Working with 3ds Max Texturing a game-ready cube 3D packages, helpful tools and how to obtain them There are various applications being used for modding. Although some has more tools available, there really isn't one that tops the others. In this section there'll be lists of a few 3D packages and tools used for modding. 3ds Max, arguably the most used program with the greatest amount of third-party plugins and scripts for various games. For GTA:SA, this program is favored by many modders due to it having 3rd party scripts for dealing with animations, collisions, lighting, modeling etcetera. There isn't much that 3ds Max can't, that other programs can, when it comes to GTA:SA modding. Although this can be expensive to run on a longer term, there are education licenses available which last for 3 years. These do not allow commercial use, and is marked purely as "educational use only". View more. Kam's (vanilla) max scripts, the first official script package for modding GTA:SA with 3ds Max. After the release of his scripts, a lot of others has developed scripts of their own, some of which are more optimized and less prone to issues. Even despite Kam's scripts having overseen issues, it is still to this day widely used for tasks such as, but not limited to; IPL map generation and import, collisions, animations, characters, vehicles, environment modeling. View more. Kam's (2018) max scripts, a modified version of Kam's vanilla scripts for 3ds Max. Notable features that were added are; DK22pac's Normal map plugin support, reflection map support for environment models, 2dfx panel for lights such as aircraft lights or street lamps. View more. The Hero's RW importer/exporter, a modern plugin that works extremely well with vehicles and environment models. Due to its simplified layout it is very easy to get used to. It's far recommended to use for vehicle model import/export due to its quality handling and materials, which are based on RW formats (renderware, the engine GTA:SA runs off). With the plugin using different model material formats from Kam's, it comes with a maxscript to convert scene materials from GTA_MTL to RW_MTL and vice versa, if needed by the modeler. View more. Deniska's max scripts, a pack for various types of GTA:SA modding, some features are obsolete for MTA users due to IPL and IDE modification required. Although, the pack does come with a few tools that may be useful to MTA modders, such as prelight tools to set the vertex colors and illumination to fixed values. View more. DexX's 2dfx export script, a standalone 3ds Max script that exports Omni and Dummy informations to .sae file formats, to then be added to the .dff using RW analyzer. With this script it's possible to integrate lights and particles into custom models, e.g flashing aircraft lights, street lights, fire and smoke, etcetera. With the release of Kam's 2018 scripts, this script is used less as using Kam's may be less work for some cases. View more. Blender 3D, a freeware (yes, completely free, no paid watermarks or any limitations), not as favored by modders throughout the years until recently, where a developer has released his script 'DragonFF' on GTAforums. Although it is WIP, modders has already binned 3ds Max and moved permanently to Blender. Although Blender is free, it actually combines several programs into one, allowing a Blender user to sculpt, paint, do lighting, professional rendering and modeling in one. A recent update in 2019 changes the RMB selection to LMB and UI among other things, making for a potential alternative to 3ds Max. View more (Blender). View more (Blender GTA script) Zmodeler, not as commonly used as the aforementioned programs, although it is being used very frequently by modders in various games, most notably for GTA:games. It does not have support for skinned characters, although it is being commonly used for vehicles, and sometimes environment modeling as well. This is a fairly inexpensive solution, but lacks tools for more broad modding. View more. Sketchup, a 3D application that focuses on architecture. For modding, it is a rather uncommon, though has a free and paid version and can be used for seemingly OK modeling. It does not have access to any 3rd party scripts for GTA:SA, hence its only use is modeling and then exporting model files to then import into 3ds Max or Blender. View more. Photoshop, mainly used for graphic design, but can also produce 3D models, video, GIF and textures for assets. Photoshop is the most favored by modders in regards to working with textures e.g paintjobs and retexturing. Although there are alternative image editors in the market, Photoshop definitely hits the top in terms of usable scripts (user-customized scripts as well) and ease of workflow. View more. DFF Viewer, a 3D graphics engine that is used for visualising GTA:SA models and supports .DFF and .TGA formats. Only single dff's can be loaded at a time. Though this is rarely used by those who has access to 3ds Max and Blender, it is commonly used for troubleshooting/testing work that involves retexturing a model e.g changing the clothing textures of a character. This program is entirely free and available from various GTA modding sites. View more. TXD Workshop, a texture dictionary editor that has been around for years, only since recent years to be succeeded by Magic TXD. Though TXD Workshop may not be the best for setting up TXD files, it has a built-in IMG archive editor, allowing one to browse all of the contents of gta3.img. View more. MagicTXD, a new texture dictionary editor with features for mass exporting .TXD contents from folders into image subfolders, texture compression, mipmaps, resizing textures etcetera. This is broadly used for .txd files and almost took over TXD workshop when it comes to working with texture dictionaries. View more. RW Analyze, a multi-use program with notable features being; ability to lock/unlock game files, add data to game models e.g 2dfx and vertex colors information extracted from other DFF files. View more. Extracting game assets In order to start modding GTA, access to the files is required. The files in question are commonly found in parent files that require some sort of program to open. In this case, TXD Workshop or any IMG editor and optionally Magic TXD for later on will work just fine. The below steps shows one way to extract all models and their texture dictionaries. For IMG editors (e.g Alci's IMG Editor): Open the editor. Under File, select Open. Find gta3.IMG stored in GTA SA directory\models. Highlight the first file in the list, then scroll down to the very bottom and SHIFT+LMB click the file on the bottom. This highlights every file in GTA3.IMG. Right click the list of files and select Export. On the popup window, find and select, or create a new folder on desktop called GTA SA ASSETS. Click enter to proceed. ((For cases where specific files are wanted, use the search field to find the necessary files and export them individually)) For TXD Workshop users: Open TXD Workshop. In the toolbar it says Open IMG. Click this, then find and select gta3.IMG stored in GTA SA directory\models. Highlight the first file in the list, then scroll down to the very bottom and SHIFT+LMB click the file on the bottom. This highlights every file in GTA3.IMG. Right click the list of files, select Extract. On the window, find and select, or create a new folder on desktop called GTA SA ASSETS. Click enter to proceed. ((For cases where specific files are wanted, use the search field to find the necessary files)) Now the folder GTA SA ASSETS contains nearly every .dff, .col, .txd and so on used by the game. Assuming one would like having all of the textures in PNG, DDS, TGA or any other common image format, they may follow the below steps using Magic TXD. Inside GTA SA ASSETS create a new folder named IMAGES. Open any .txd file found in GTA SA ASSETS using Magic TXD. Navigate to the toolbar. On Tools, click Mass export. Export settings are as following. Game root = root folder containing TXD's Output root = folder where images goes Image format = self explanatory With texture names only = exports images directly to folder and duplicate named ones gets replaced by one another Pre-pended with TXD name = exports images with TXD prefix In separate folders = makes new folder(s) for every TXD's contents Hit export. This process may take some time. Note that this process is the same for other .IMG archives such as player.img. There are also .txd and .dff files elsewhere, such as \models\generic\generic.txd, which is the vehicle shared texture dictionary file. How each type of game model works Models used on GTA SA uses different rendering techniques and data hierarchy than others. This section will introduce the features that some models has that others don't. Vehicles: Vehicle model components utilises hierarchies, where each component is linked to a dummy (helper) and each dummy is linked to parent dummies e.g chassis_dummy, for them to be registered in the hierarchy. In order for vehicles to not look flat or cartoon, a few steps are made in the model; Diffuse material is given a grunge texture or AO map, this helps telling the depth of the vehicle as well as giving it a feel of realism, so it isn't just clean. A specular lighting image is applied to the vehicle surface material, giving it a fake shine when looking from certain angles. If the vehicle has hard edges (smoothing), this image can increase the visibility of the normals, retaining its original look rather than being flat without visible difference in geometry. An environment (ENV) map is applied to the vehicle surface material, producing a fake reflection that is animated horizontally as the vehicle travels. Vehicles also has a lot of hardcoded features such as headlights, brake lights, emissive lights, taxi/aircraft lights, rotatable components and dynamic collisions for special vehicles like Forklift. Vehicles are also the only dff models that uses baked collisions, which means they are stored in the .dff itself. Below is a detailed hierarchy used for cars, and special components used by a number of vehicles (click the spoiler). Skin characters: Ped skin characters uses bones (dummy objects) that are connected to each other and linked to the character model. These bones are not visible in-game. In order for the bones to know what part of the 3D model they're responsible for, the skin needs to be rigged. Character rigging for GTA:SA is done by applying weigh on vertices. Using heatmap display, colors go through blue-red, low-high respectively. Values go from 0 to 100. If the value is 0, it means that the vertex is not used for any bone. This can cause issues. If the value is < 100, it means that the vertex is used for multiple bones. This results in smooth animations ingame, as the 3D model transitions smoothly through each bone. If the value is 100, it means that the vertex is only responsible for one bone. Skin rigging is generally something that is being avoided by modelers and makes Skin modeling the most difficult on GTA. Bones are as shown: CJ character: Carl Johnson's 3D model is split into several pieces in order to be compatible with the clothing script used to let the player customize CJ. These models uses a function known as multiclump to support 3 meshes per dff; normal, ripped and fat. This is for CJ's health stats to physically show in-game. Other than multiclump and additional bones, modding CJ skin is essentially the same as any other ped skin. Map environment: World objects .dff contains only single models, though they do support omni and dummy objects for 2d effects. These types of models uses Vertex Colors/Face Colors. This requires the modeler to paint colors onto the model which is then stored in the vertex colors channel (daytime) and vertex illumination channel (nighttime). Although uncommonly used by R*, these models do support reflection maps like vehicles use. Goldfish's modified version of Kam's scripts is excellent for exporting with reflection maps. GTA SA utilises multiple collision archives (.col) for every IPL district, being responsible for all of the world objects' collisions. However, on MTA, collision archives are not supported, so custom collision files are single models per .col. Not every object uses collisions though, some merely has their bounding space. These objects can not be selected with MTA map editor, thus requires additional scripting or modding. Limitations - MTA vs GTA Speaking of native support, MTA currently is behind in several places. Notable features that aren't available on MTA, but on GTA are as following. Item Placement (IPL) - another type of mapping file, but contains a lot more functions such as zones for real-time reflections as seen in interiors. Item definition (IDE) - a file used to but not exclusively, define settings for models, enabling alpha flags, disabling backface cull, enable breakable effect and much more. Limit adjuster - a rework of the game that allows for adding more ID's and bypass common limits. This however is being developed by one of MTA's contributors. There are various limitations such as polys per model, max dimensions for models and collisions, (very) strict size limits for collisions and CPU usage that can easily cause issues for modders. Not to mention the majority of the game data files which most MTA servers likes to force original, else the player won't be able to connect. These limits all has potential solutions being developed as with the limit adjuster. Working with 3ds Max As described above, 3ds Max is without a doubt the most common program for GTA modding. It's also used by professionals within architecture and visualisation and film industry. What's amazing about this program is that whatever is created in 3ds Max can ultimately be added to the game. A modeler made a square - it can get added right away, no adjustments required. That's the charm of 3ds Max. There's no need for additional tools to process the model for it to be compatible with GTA. It is also the primary program that Rockstar's developers used for creating the environment in GTA:SA. At a first glance, the program may seem rather intimidating. The main functions of the program that a beginner should be aware of are listed below. Shows the default home screen with 4 viewports. Left, Top, Front and Perspective. The 3 side ones are Orthographic viewports while Perspective is in regular mode. It is also the most common one to use. Highlighting a viewport and pressing (left)ALT W will full screen the viewport. In order to rotate camera view, the user must click and drag the square in the upper right corner. Its face also tells which side the camera is viewing e.g Top. If one wishes to see viewport statistics such as polygons per model, vertex amount etc., clicking: [ + ] icon on the upper left side > Configure Viewport > Statistics > Total + Selection > Apply > Clicking 7 on keyboard shows the statistics. This feature is extremely useful for modelers who are limited in polygons per model, or simply wants to see how many polys a car is. Common keyboard shortcuts F1: Opens Autodesk help section in new browser tab F2: Displays blue overlay on models F3: Displays models in wireframe F4: Displays edges on models F10: Opens render setup 9: Shows viewport statistics Q: Select objects W: Select and move E: Rotate R: Select and (mode) scale U: Orthographic viewport mode P: Perspective viewport mode A: Toggle angle snap S: Enable snap D: Disable viewport G: Enable/disable grid J: Display bounding edges LALT X: Xray mode for model Ctrl Z: Undo action Ctrl Y: Redo action In a heavy program like 3ds Max, being able to change preferences to one's likings is important. Do so by going to Customize > Preferences. Performance, file settings and such can all be configured in there. For GTA:SA modding, knowing how to subdivide and add geometry to existing GTA models is very important. Below is a list with actions that may come in handy. No-brainer: Editable Mesh is inferior to Editable Poly. Use Poly, poly, poly, poly... Editable mesh modeling Vertex selection mode Edit Geometry section Attach: attaches another model in the scene to the selected mesh Chamfer: chamfer selection of vertices; creates additional geometry Weld: merges vertices together within a specified threshold Surface Properties section Edit Vertex Colors: sets the color and illumination of selected vertices Edge selection mode Edit Geometry section Divide: divides an edge, adding a new vertex where it was divided/split Extrude: create and pull a new face out from existing edges (keyboard shortcut: LSHIFT + LMB-drag) Face selection mode Edit Geometry section Divide: creates a new face Extrude: pulls the select face(s) outwards or inwards and creates new geometry off that Bevel: essentially an Extrude followed by scaling of the face Surface Properties section Flip: flips a face 180 degrees Smoothing groups: defines the smoothing of the model. Autosmooth is in many cases OK, but may not fulfil everyone's expectations Editable poly modeling Vertex selection mode Edit Vertices Connect: selecting 4 verts on a box side and using this function will triangulate the side. Edge selection mode Edit Edges Connect: creates an edge between the selected edges, as in a bridge between two cliff sides (use the 'Settings' to choose between multiple or one edge on creation) Polygon selection mode Edit Polygons Inset: places a new polygon inside the selected, allowing to be scaled Bridge: connects two opposing polygons by creating a bridge between them (can be used for walls and gaps) Edit Geometry Slice Plane: enables the user to create a perfect cut on the model, can be rotated by degrees Rendering scene Modelers working on projects for companies or friends might want to show what they've accomplished, but a regular screenshot may not suffice. Talking of a screenshot like this: Instead, the modeler might want to show the scene with textures. Perhaps more than just textures - lighting? reflections? transparency? - this is where 3D rendering comes into play, and can be done by simply pressing SHIFT + Q on the keyboard. This can also by default use alpha channel. However, the quality could improve. The quality of the render depends on the scene assets (models, materials, lights), the Renderer and its settings. By default, 3ds Max utilises Scanline Renderer. This is not a production quality render, but rather meant for test shots and demos. Though the quality isn't great, it's still possible to produce seemingly interesting renders. The following render took merely 8 seconds. Using 3ds Max allows modders to bring GTA:SA into modern graphics, easily comparable or even superior to ENB's. It also enables modelers to share visualizations of their models to help the customer understand how it could potentially look for their game. In the above render, a Skylight is used with Scanline Renderer. A very basic render, though interesting and contains lots of depth. In order to replicate this result, below are the steps to follow: On the Create panel, where one would normally find boxes and spheres, click the toolbar Lights. Where it says Photometric change that to Standard. Click the Skylight and place it in the 3ds Max scene. Settings for Skylight explained Multiplier: intensity of the light Sky color: the color of the light Cast shadows: enable to produce shadows, though this is more of an Ambient Occlusion than actual shadows Rays per sample: quality of the shadow, ideally keep at <5 for tests and 15-20 for final shots In the actual render above, a sample of 5 was used, creating grainy shadows but quick render. Backface culling was enabled to avoid slowing down the render time. Skylight is great light source and is generally used to illuminate an entire scene and not particular models. In the same Lights tab, one may find use of Omni or Free lights, which both works great. These are great point lights, which as opposed to skylight, are able to illuminate parts of the scene e.g acting as street lights. Modifiers When modeling, modifiers can come in use and save the modeler a lot of time. The following modifiers are highly suggested for beginners to know about. Bend: bends the model, effect depends on the differences in the geometry Mirror: copies the mesh and mirrors it on the other side, commonly used for vehicles using symmetrical geometry Smooth: generates and applies smoothing to the model, generally the lower values makes for higher file sizes Symmetry: essentially the same modifier as 'Mirror' Turbosmooth: Smoothens the mesh, adding geometry, uses iterations Unwrap UVW: advanced UV editing, commonly used for preparing textures for models like characters and game assets UVW map: basic UV editing, X/Y/Z projection mapping as well as spherical, box and planar mapping Vertexpaint: allows for painting colors onto vertices and faces, these colors are rendered during either ingame or night time Texturing a game-ready cube Modeling has to start somewhere. Using standard 3D primitives is a good place to start. For the purpose of this guide, a Cube will be created in 3ds Max and textured in Paint.net, a free image editing software. Video tutorial: To start off, navigate to 3ds Max's Create tab on the right hand side panel, as shown below. Shows the Create tab on the panel. For this guide, click on Box (Cube). Use LMB and click and drag the mouse in the viewport to create the cube. Now that the Cube primitive is spawned in the viewport, on the same panel that it was created from, go to Modify tab and set its dimension parameters to 5,0, 5,0, 5,0 and 1 segment for all 3. Convert the model to Editable Poly by right clicking it in the Viewport > Convert to > Editable Poly. Go into Polygon selection mode and scroll down until the following buttons are visible: With viewport selected, on the keyboard press `CTRL A` to select all faces on the cube. Now, where it says `Color`, click the bar and on `Value` set it to 100, then do the same for `Illumination` but value at 35. What this does is it sets the vertex colors so that the model won't be overexposed during day/night time. Exit polygon selection mode and on Modifier List, click that and find Unwrap UVW. This applies a modifier stacked on top of the Editable Poly mesh. Under Edit UVs click Open UV Editor. This allows the user to make changes to the UV coordinates which tells the model how textures are projected onto the model. On the editor, ensure that Polygon selection is enabled. While in the UV editor, press `CTRL A` to select all UV islands. On the top of the editor click Mapping, then Unfold Mapping.... Keep it as Walk to closest face and enable Normalize Clusters. Click OK. The result should remind the user of how a simple cardboard box in real life looks when it's yet to be folded into a box. With the model unwrapped, on the toolbar on the UV editor, click Tools > Render UVW Template. The export settings below are ideal for this particular task. If one wishes to know exact dimensions of each square, enable Seam Edges. After exporting, on the modifier stack, press Collapse to. This saves the new UV's. The width and height should be on a 1:1 ratio to avoid stretching issues. 1024x1024 is more than enough. On the rendered image window, click the Save button and find a location to save it in, name it Cube_unwrapped and use Alpha channel (optionally). Now open Paint.net and insert the image. Once happy with the result, export as cube_diffuse. Diffuse map generated with the help of a UVW template. In order to apply the texture on the model, simply drag and drop the image from file browser onto the model in the Viewport. Although the example above is not textured properly in regards to rotations, it shows what can be done by using UVW templates, and how easy it really is to produce textures for models made from scratch. The model can be directly exported as DFF. Materials are not required to be GTA or RW, they can be standard and still show ingame. Some exporters wants the model in Editable Mesh however, so converting it may be required. Thanks for reading this guide, we hope it helps and we wish you the best of luck with modelling! For questions on modding, please refer to MTA's modding FAQ or MTA discord #modelling channel.
    1 point
  6. function updateEngineSound() -- We get a table of all vehicles on the server: local allVehicles = getElementsByType("vehicle") -- we then do a loop that will iterate over that table: for index, veh in ipairs (allVehicles) do --It's like saying: "For each vehicle, do this" -- we get the model of the vehicle local model = getElementModel(veh) -- if the model is equal to 411 then do this if model == 411 then -- if the engine is on if getVehicleEngineState(veh) then -- we get the position of that vehicle local x, y, z = getElementPosition(veh) -- we then try to get the sound we maybe created and stored as an element data -- for that vehicle. If we didn't yet, then it will return false. local sound = getElementData(veh, "engineSound") -- if the inverse of sound is true (same as: if sound is equal to false) -- Note that "not false" will give true if not sound then -- we create the sound at the veh position and loop it sound = playSound3D("sounds/song.mp3", x, y, z, true) -- we store that sound in an element data I decided to call "engineSound" setElementData(veh, "engineSound", sound) end -- if the sound is paused (because the engine was off) then if isSoundPaused(sound) then -- we "unpause" the sound setSoundPaused(sound, false) end -- we then need to get the speed local velocityX, velocityY, velocityZ = getElementVelocity(veh) -- calculate the global speed in mph from the 3 velocities: -- use pythagorean theorem to get actual velocity -- raising something to the exponent of 0.5 is the same thing as taking a square root. local actualspeed = (velocityX^2 + velocityY^2 + velocityZ^2)^(0.5) -- multiply by 50 to obtain the speed in meters per second and -- then by 111.847 to obtain the speed in meters per hour local mph = actualspeed * 50 * 111.847 -- we try to calculate the sound speed according to the mph -- I guess 80mph is the speed that the original sound sounds like and -- I also guess 0.25 is the min speed that the sound can be at to still sounds like an engine. -- I added 80/minSoundSpeed to 80 to compensate the minSoundSpeed we added local minSoundSpeed = 0.25 local soundSpeed = mph/(80+80/minSoundSpeed) + minSoundSpeed -- and then we apply it to the sound setSoundSpeed (sound, soundSpeed) -- and finally update the sound position to follow the vehicle setElementPosition(sound, x, y, z) else -- otherwise (so if the engine is off) -- we pause the sound setSoundPaused(sound, true) end -- close the "if engine was on" end -- close the "if model was 411" end -- end of the loop end setTimer(updateEngineSound, 50, 0) --repeat that function every 50 ms
    1 point
×
×
  • Create New...