Jump to content

Linux_Shines

Members
  • Posts

    35
  • Joined

  • Last visited

About Linux_Shines

  • Birthday 21/12/1990

Details

  • Location
    Earth
  • Interests
    Everything

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Linux_Shines's Achievements

Rat

Rat (9/54)

0

Reputation

  1. Hello. So, I'm using [this script right here]. I've edited it just a little bit to actually show the vehicle's RPM and amount of gears, yet I'd like to make one more change and... I'm stuck a little, because I've no idea what kind of "if condition" should I use. Below is an example of a single condition where I'm comparing the amount of gears to the maximum amount of gears and if it's the same, then the dxDrawText color changes from black to red, works. if RESKINNED_DEBUG and vehicle == myVehicle then if(tostring(data.gear) == tostring(#gearRatios)) then -- maximum amount of gears dxDrawText(tostring(#gearRatios), (screenW * 0.8562) - 1, (screenH * 0.8148) - 1, (screenW * 0.9031) - 1, (screenH * 0.8380) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(tostring(#gearRatios), (screenW * 0.8562) + 1, (screenH * 0.8148) - 1, (screenW * 0.9031) + 1, (screenH * 0.8380) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(tostring(#gearRatios), (screenW * 0.8562) - 1, (screenH * 0.8148) + 1, (screenW * 0.9031) - 1, (screenH * 0.8380) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(tostring(#gearRatios), (screenW * 0.8562) + 1, (screenH * 0.8148) + 1, (screenW * 0.9031) + 1, (screenH * 0.8380) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) -- gears dxDrawText(tostring(data.gear), screenW * 0.8562, screenH * 0.8148, screenW * 0.9031, screenH * 0.8380, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) else dxDrawText(tostring(data.gear), (screenW * 0.8562) - 1, (screenH * 0.8148) - 1, (screenW * 0.9031) - 1, (screenH * 0.8380) - 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(tostring(data.gear), (screenW * 0.8562) + 1, (screenH * 0.8148) - 1, (screenW * 0.9031) + 1, (screenH * 0.8380) - 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(tostring(data.gear), (screenW * 0.8562) - 1, (screenH * 0.8148) + 1, (screenW * 0.9031) - 1, (screenH * 0.8380) + 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(tostring(data.gear), (screenW * 0.8562) + 1, (screenH * 0.8148) + 1, (screenW * 0.9031) + 1, (screenH * 0.8380) + 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(tostring(data.gear), screenW * 0.8562, screenH * 0.8148, screenW * 0.9031, screenH * 0.8380, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end end And here's the code I'm using to show the vehicle's RPM: dxDrawText(string.format("%4d", tostring(rpm)), (screenW * 0.8562) - 1, (screenH * 0.6759) - 1, (screenW * 0.9031) - 1, (screenH * 0.6991) - 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(string.format("%4d", tostring(rpm)), (screenW * 0.8562) + 1, (screenH * 0.6759) - 1, (screenW * 0.9031) + 1, (screenH * 0.6991) - 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(string.format("%4d", tostring(rpm)), (screenW * 0.8562) - 1, (screenH * 0.6759) + 1, (screenW * 0.9031) - 1, (screenH * 0.6991) + 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(string.format("%4d", tostring(rpm)), (screenW * 0.8562) + 1, (screenH * 0.6759) + 1, (screenW * 0.9031) + 1, (screenH * 0.6991) + 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText(string.format("%4d", tostring(rpm)), screenW * 0.8562, screenH * 0.6759, screenW * 0.9031, screenH * 0.6991, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) It was literally added after the condition I pasted above. Unfortunately the further, the worse. I've been trying to make completely random conditions such like if(string.format("%4d", tostring(rpm)) < string.format("%4d", tostring(rpm))-500) then dxDrawText(string.format("%4d", tostring(rpm)), (screenW * 0.8562) - 1, (screenH * 0.6759) - 1, (screenW * 0.9031) - 1, (screenH * 0.6991) - 1, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) ... else dxDrawText(string.format("%4d", tostring(rpm)), (screenW * 0.8562) - 1, (screenH * 0.6759) - 1, (screenW * 0.9031) - 1, (screenH * 0.6991) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) ... end but... nah, they don't seem to work. What should I do and... is it even possible to compare one string to another and just check whether the value of this string is less than, for example 500, or not?
  2. Hello. I want to change speedometer colour by speed (for testing), but... I don't know, how to do this. I did it in the following way (I have this lines in function UpdateDisplay()): speedx, speedy, speedz = getElementVelocity(localPlayer) g_GuiLabel.Speed:color(255 - math.ceil(speedx * speedy), math.ceil(speedx * speedy), 255) But... from what I see, displayed color is ... pink. How can I dynamically change colour, from white (or something else, like green) to red, when white (or green) is 0 km/h and red is more than 200 km/h? @edit: Oh, I just solved this, but I want to share my code with other peoples, who will also have this problem function UpdateDisplay() if not getPedOccupiedVehicle(localPlayer) then hideSpeedometer() end g_GuiLabel.Speed:postGUI(true) g_GuiLabel.Speed:text(tostring(GetVehicleSpeed())) local x, y, z = getElementVelocity(getPedOccupiedVehicle(localPlayer)) local speed = math.floor(math.sqrt(x ^ 2 + y ^ 2 + z ^ 2) * kph_multiplayer) if speed < 254 then g_GuiLabel.Speed:color(255, 255 - speed, 255 - speed) else g_GuiLabel.Speed:color(255, 0, 0) end end
  3. Holy fu... I mean - oh man... I mean... oh, nevermind. It's just awesome. In any case - did I good think that the "PlaySFX" function will now be able to play the sounds of vehicles? Because I read on the wiki about this feature and it;s not written there anything that has to do with the vehicles...
  4. Did you plan to publish this? Or is it possible to get it from you somehow?
  5. Hi. Today I discovered an unusual issue/bug(?) - while browsing users list, I saw such a thing: I just click on Members, and after loading the page I clicked again on random letter. Link for url, which show that message: memberlist.php&first_char=a#memberlist
  6. Hi, I have an little, short, question, like in title of thread - is it possible to ADD completely new cars to the game? And please - don't write to me 'bout replacing of a car - I know how to do. AFAIK, it's possible to do this in a... "clean" GTA SA, so I think that maybe it is possible in MTA SA too?
  7. I know, that I can use Audacity and I'm using it ( ), but I don't know rate of sound and even if I change it to 44100 Hertz (like in your sounds), I've same issue like I wrote before.
  8. It's sad that you don't want to release source... But I've found new source of sounds - NFS High Stakes™© (and other Trademarks). With NFS Wizard I'm extracted all sounds from files CARENG.BNK, OCARENG.BNK and SCARENG.BNK. Actually I'm testing the sounds of cars at home and... they sound strange, because at maximum RPM the sound is "unreliable" (or rather "break"), but still very good. If you want, I can upload all the extracted sounds, maybe you'll know how to fix these sounds, because with your script, they may be really very, very good. (I love to repeat the words)
  9. Topo1st, when you update the resource to new version? And... are you plan to release a source code?
  10. Hm... I'm think that I've found something weird... or maybe it must be, I dunno. But I'm think it's something like issue - every car have 11000 RPM. Maybe (I'm only suggest) you can do, that every car have other RPM in XML file?
  11. Very good and nice script, but it's possible to made other version (second?), with automatic transmission?
  12. Wychodzi na to, że jednak powinienem jeszcze raz przejrzeć dokładniej wiki. I to dużo dokładniej. Tylko że San Andreas mi się ciągle psoci, jeżeli chodzi o te biegi... W każdym razie póki co to mam takie coś (głównie zmiana handlingu, nie zajmuję się jeszcze modulacją): -- Modyfikowanie prowadzenia się Infernusa: function InfernusTuning() infernus = 411 for _, veh in pairs(getElementsByType("vehicle")) do if getElementModel(veh) == infernus then setVehicleHandling(veh, "mass", 1000) setVehicleHandling(veh, "turnMass", 2000) setVehicleHandling(veh, "dragCoeff", 4) setVehicleHandling(veh, "centerOfMass", { 0, -0.1, -0.1 } ) setVehicleHandling(veh, "percentSubmerged", 80) setVehicleHandling(veh, "tractionMultiplier", 0.95) setVehicleHandling(veh, "tractionLoss", 0.9) setVehicleHandling(veh, "tractionBias", 0.42) setVehicleHandling(veh, "numberOfGears", 1)-- do testu, było 5) setVehicleHandling(veh, "maxVelocity", 420) setVehicleHandling(veh, "engineAcceleration", 22) setVehicleHandling(veh, "engineInertia", -0.1) setVehicleHandling(veh, "driveType", "awd") setVehicleHandling(veh, "engineType", "petrol") setVehicleHandling(veh, "brakeDeceleration", 6) setVehicleHandling(veh, "brakeBias", 0.5) setVehicleHandling(veh, "ABS", false) setVehicleHandling(veh, "steeringLock", 30) setVehicleHandling(veh, "suspensionForceLevel", 0.95) setVehicleHandling(veh, "suspensionDamping", 0.25) setVehicleHandling(veh, "suspensionHighSpeedDamping", 1.25) setVehicleHandling(veh, "suspensionUpperLimit", 0.2) setVehicleHandling(veh, "suspensionLowerLimit", -0.1) setVehicleHandling(veh, "suspensionFrontRearBias", 0.45) setVehicleHandling(veh, "suspensionAntiDiveMultiplier", 1) setVehicleHandling(veh, "seatOffsetDistance", 0.38) setVehicleHandling(veh, "collisionDamageMultiplier", 0.5) setVehicleHandling(veh, "monetary", 2000000) setVehicleHandling(veh, "modelFlags", 0x0) setVehicleHandling(veh, "handlingFlags", 0x1708803) setVehicleHandling(veh, "headLight", 1) setVehicleHandling(veh, "tailLight", 1) setVehicleHandling(veh, "animGroup", 1) end end end addEventHandler("onPlayerVehicleEnter", getRootElement(), InfernusTuning) Szkoda, że funkcje wymienione przez Ciebie nie są jakoś dokładniej opisane (w przykładach jest tylko "-- TODO"), bo gdy próbuję ich używać, interpreter w trakcie gry wypluwa a gdy używam kodu powyżej isetVehicleHandling(veh, "numberOfGears", 1) to auto ciągle przyspiesza do maksymalnej prędkości, tylko że zmienia jeden raz bieg i po prostu rozpędza się do tych 420 km/h...
  13. Co do pobierania biegów - zauważyłem, że MTA stara się poprawnie interpretować biegi, wskutek czego nawet przy zmodyfikowanym handlingu wyświetla prawie dobrze odpowiednie biegi. A propos handlingu - w jaki sposób można zmieniać biegi? Bo w hedit nie widzę opcji zmiany długości jakiegoś biegu, tylko ogólna prędkość, etc. A co do edita - czy mógłbym Cię poprosić o jakiś pseudokod, ewentualnie przerobienie w odpowiedni sposób na pseudokod tego, co umieściłem w pierwszym poście? Bo właśnie ciężko mi ogarnąć przyklejanie dźwięków z tego powodu, że się na siebie nakładają (pewnie wina onClientRender).
  14. Ta funkcja działa... ale dosyć dziwnie i nie sprawdza dźwięku, jaki jest odtwarzany podczas jazdy, tylko losowo wyświetla zmianę biegów... Lecz - czy można byłoby zrobić takie coś, że dźwięki auta są modulowane, ewentualnie odtwarzane jeden po drugim? Już pal licho z biegami.
  15. Heloł, ledwo zamknąłem poprzedni temat, a już tworzę kolejny. No ale... Mniejsza z tym... W każdym razie - czy jest możliwe pobranie długości dźwięku pojazdu i stworzenie na podstawie tej długości dźwięku obrotomierza? Dokładniej - chodzi mi o to, że w San Andreas odgłosów auta jest zaledwie 5, a mi chodzi o pobranie tych: Następnie pobrane dźwięki chciałbym w jakiś "magiczny sposób" przypisać do prędkościomierza, dzięki czemu uzyskałbym ilość obrotów silnika dla każdego auta. Tak więc - czy jest to w ogóle możliwe? @edit: Z tego co widzę, to jest to jak najbardziej możliwe, tylko teraz jak to oskryptować? @edit 2: Udało mi się zrobić takie coś, niestety - dźwięki nakładają się do siebie: -- Hotring: engineImportTXD(engineLoadTXD("hotring.txd"), 494) engineReplaceModel(engineLoadDFF("hotring.dff", 494), 494) -- Infernus: engineImportTXD(engineLoadTXD("infernus.txd"), 411) engineReplaceModel(engineLoadDFF("infernus.dff", 411), 411) -- Infernus - podmiana dźwięku: local FilePath = "Bank_001/sound_002.wav" local FilePath_2 = "Bank_002/sound_001.wav" local FilePath_3 = "Bank_002/sound_002.wav" function getElementSpeed(element, unit) if(unit == nil) then unit = 0 end if(isElement(element)) then local x, y, z = getElementVelocity(element) if(unit=="kph" or unit == 1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 100 end else outputDebugString("Nie mogę pobrać prędkości pojazdu.") return false end end addEventHandler("onClientRender", root, function(keyState) local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle) then if(keyState == "down") then local sound = playSound("Bank_002/sound_003.wav", false) setSoundVolume(sound, 0.05) setSoundMaxDistance(sound, 40) end if getElementSpeed(vehicle, "kmh") == 0 then StartNeutralEngineSound() elseif getElementSpeed(vehicle, "kmh") > 0 or getElementSpeed(vehicle, "kmh") < 400 then StartDriveSound() elseif getElementSpeed(vehicle, "kmh") > 0 then StartMaximumSound() else DestroySound() end end end) function StartNeutralEngineSound() -- if isElement(sound) then return false end sound = playSound(FilePath, false) setSoundVolume(sound, 0.05) setSoundMaxDistance(sound, 40) end function StartDriveSound() -- if isElement(sound2) then return false end if isElement(FilePath_2) then destroyElement(FilePath) end sound2 = playSound(FilePath_2, false) setSoundVolume(sound2, 0.05) setSoundMaxDistance(sound2, 40) end function StartMaximumSound() -- if isElement(sound3) then return false end if isElement(FilePath_3) then destroyElement(FilePath_2) end sound3 = playSound(FilePath_3, false) setSoundVolume(sound3, 0.05) setSoundMaxDistance(sound3, 40) end function DestroySound() if isElement(FilePath_3) or isElement(sound3) then destroyElement(FilePath_3) destroyElement(sound3) end end
×
×
  • Create New...