Jump to content

koragg

Members
  • Posts

    731
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by koragg

  1. Default maps are in server-mods-deathmatch-gamemodes-race-maps if i remember correctly. You can't put the same map with the exact same name twice in your server. It just won't load neither of them. So i advise you to delete the default maps unless there are ones that you specifically like and to just put your maps in a [maps] folder under "resources".
  2. Nice, works like a charm. But is there a way to keep the focus of the camera behind the object when I'm not moving my mouse? I mean, when the object I'm spectating (a ghost car) makes a turn the camera stays at the same spot at which I left it via my mouse. I need it to go behind the object (ghost car) after a few seconds of not moving my mouse. Hope you can help!
  3. This did it, camera moves around while spectating ghost vehicle just as if I'm spectating a normal player: But is there a way to keep the focus always behind the vehicle (while not moving the mouse)? Right now if the ghost vehicle makes a turn the camera remains facing the spot I left it at with my mouse. It should go back to behind the ghost car automatically. Any help appreciated!
  4. Thanks a lot for sharing. I guess to disable it i put the same function again?
  5. And the distance is how far you see around the object, right?
  6. A similar effect is done on 6s server. I too would like to know how.
  7. @orel56000 AngX and AngZ are not defined anywhere and give error. Can you give example on how to use these functions to set the camera on an object and make it move freely to look around that object via mouse move (just like it is in normal spectating).
  8. Would this work btw? https://community.multitheftauto.com/index.php?p=resources&s=list&name=freecam&descr=&category=
  9. You can do like this: local state = getElementData(localPlayer, "player state") if state == "dead" or state == "waiting" then return end Here's how to sync it (lines 6-10): function nitroShow() if isPedInVehicle(localPlayer) then local target = getCameraTarget() local car = getPedOccupiedVehicle(localPlayer) local nitro = getVehicleNitroLevel(car) if target and getElementType(target) == "vehicle" then nitro = getVehicleNitroLevel(getVehicleOccupant(target)) elseif target and getElementType(target) == "player" then nitro = getVehicleNitroLevel(target) end if isPedDead(localPlayer) then return end if nitro ~= false and nitro ~= nil and nitro > 0 then dxDrawRectangle(x*1305, y*814, x*126, y*23, tocolor(44, 44, 44, 255), true) -- Nos Show dxDrawRectangle(x*1305, y*814, x*126/10*10*nitro, y*23, tocolor(0, 70, 149, 255), true) -- Nos Show dxDrawText((math.floor(nitro/1*100)).."% Nitro", x*1290, y*810, x*1454, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Nos Show else dxDrawText("No Nitro", x*1290, y*810, x*1454, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Nos Hide end end end addEventHandler("onClientRender", root, nitroShow)
  10. lol I needed the exact same thing just a few hours ago Have a look at my topic: The functions which did it for me were: GetCamera() setElementPosition() atachElements() The code example at the first function's wiki is what we're looking for.
  11. GetCamera (combined with the other functions in it's example) fixed a huge part of the problem Thanks @pa3ck, @CodyJ(L) would be nice, only thing left to do is to enable free camera movement while spectating the ghost vehicle.
  12. But i don't need to set the target to myself. It should be kept on the ghost car, only need to enable camera movement. I'll try with warpPedIntoVehicle () to put myself in the ghost car and then setCameraTarget () on me. If only setCameraTarget() worked on other objects except players...it would be so easy to achieve this.
  13. Sadly i have no idea why it won't work then. Check to see if the column name is indeed "player state" and not something else. Maybe my scoreboard is so modified that those things work only in it. Who knows
  14. Hey guys, I feel a bit awkward asking for a function name but...xd I'm pretty sure there was some function to force the player's camera movement on and off. What I mean is that after i set the camera with setCameraMatrix() I can't use the mouse to look around me. So I need to add that function which forces camera movement to be on after using setCameraMatrix(). Hope some of you remember it, I asked a few guys but none do PS: It's for my race ghost spectating resource.
  15. Weird, works for me. Maybe you're not using the dxScoreboard?
  16. I doubt that you'll find exactly what you're looking for. Better download one of the given resources and edit it with your preferences (on / off switch for everything, adding sirens etc).
  17. Here you go: https://www.mediafire.com/file/bk1ipa4vhq1swal/scoreboard.zip
  18. Here you go. By the way instead of removing it when you're spectating you can make it update the health and nitro level of the person you're spectating so it shows their values. Anyway, code to remove both if you're spectating below, let me know if you want to sync it instead and I'll be glad to help you out (it's ready for me, just copy-paste xd). local sx, sy = guiGetScreenSize() local px, py = 1600, 900 local x, y = (sx/px), (sy/py) function drawHealthAndNOS() local playerVehicle = getPedOccupiedVehicle(localPlayer) if playerVehicle then local vehicleHealth = getElementHealth(playerVehicle) local vehicleSpeed = getElementVelocity(playerVehicle) if isPedDead(localPlayer) then return end local state = getElementData(localPlayer, "player state") if state == "spectating" then return end dxDrawLine(x*1293, y*802, x*1590, y*802, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(x*1293, y*886, x*1590, y*886, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(x*1293, y*801, x*1293, y*887, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(x*1590, y*800, x*1590, y*886, tocolor(0, 0, 0, 255), 3, true) dxDrawRectangle(x*1294, y*803, x*297, y*83, tocolor(0, 0, 0, 170), true) -- Rahmen dxDrawRectangle(x*1454, y*814, x*126, y*23, tocolor(44, 44, 44, 255), true) -- Health dxDrawRectangle(x*1454, y*814, x*126/1000*vehicleHealth, y*23, tocolor(59, 141, 0, 255), true) -- Health dxDrawText((math.floor(vehicleHealth/10)).."% Health", x*1440, y*810, x*1604, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Health sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) -- Speed vehiclekmh = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) -- Speed dxDrawText(""..tostring(vehiclekmh).." kmh", x*1358, y*857, x*1522, y*877, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, true, false, false) -- Speed end end addEventHandler("onClientRender", root, drawHealthAndNOS) function nitroShow() if isPedInVehicle(localPlayer) then local car = getPedOccupiedVehicle(localPlayer) local nitro = getVehicleNitroLevel(car) if isPedDead(localPlayer) then return end local state = getElementData(localPlayer, "player state") if state == "spectating" then return end if nitro ~= false and nitro ~= nil and nitro > 0 then dxDrawRectangle(x*1305, y*814, x*126, y*23, tocolor(44, 44, 44, 255), true) -- Nos Show dxDrawRectangle(x*1305, y*814, x*126/10*10*nitro, y*23, tocolor(0, 70, 149, 255), true) -- Nos Show dxDrawText((math.floor(nitro/1*100)).."% Nitro", x*1290, y*810, x*1454, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Nos Show else dxDrawText("No Nitro", x*1290, y*810, x*1454, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Nos Hide end end end addEventHandler("onClientRender", root, nitroShow) And in the post window there are two opposite arrows in the control bar at the top. Something like '<>'. Click that and paste your code there so it looks like in Notepad++
  19. I'm from phone so can't give any code but i did notice one thing. You can't set the flag just by setting element data as you can other things. To put flags in the scoreboard you have to use dxDrawImage. I'll give you my scoreboard's flags lines tomorrow so you see how it's made. I can give you my modified scoreboard actually. It puts flags and full country names in column called "Country". Reply here if you want it. (It didn't work by using a 3rd party resource for me neither when i tried to use one from community.)
  20. I used the same resource in my server since the design is so simplistic yet awesome looking. Try this for your case (also fixed up code a bit since it wasn't positioned correctly): local sx, sy = guiGetScreenSize() local px, py = 1600, 900 local x, y = (sx/px), (sy/py) function drawHealthAndNOS() local playerVehicle = getPedOccupiedVehicle(localPlayer) if playerVehicle then local vehicleHealth = getElementHealth ( playerVehicle ) local vehicleSpeed = getElementVelocity ( playerVehicle ) if isPedDead(localPlayer) then return end dxDrawLine(x*1293, y*802, x*1590, y*802, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(x*1293, y*886, x*1590, y*886, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(x*1293, y*801, x*1293, y*887, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(x*1590, y*800, x*1590, y*886, tocolor(0, 0, 0, 255), 3, true) dxDrawRectangle(x*1294, y*803, x*297, y*83, tocolor(0, 0, 0, 170), true) -- Rahmen dxDrawRectangle(x*1454, y*814, x*126, y*23, tocolor(44, 44, 44, 255), true) -- Health dxDrawRectangle(x*1454, y*814, x*126/1000*vehicleHealth, y*23, tocolor(59, 141, 0, 255), true) -- Health dxDrawText((math.floor(vehicleHealth/10)).."% Health", x*1440, y*810, x*1604, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Health sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) -- Speed vehiclekmh = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) -- Speed dxDrawText(""..tostring(vehiclekmh).." kmh", x*1358, y*857, x*1522, y*877, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, true, false, false) -- Speed end end addEventHandler("onClientRender", root, drawHealth) function nitroShow() if isPedInVehicle(localPlayer) then local car = getPedOccupiedVehicle(localPlayer) local nitro = getVehicleNitroLevel(car) if isPedDead(localPlayer) then return end if nitro ~= false and nitro ~= nil and nitro > 0 then dxDrawRectangle(x*1305, y*814, x*126, y*23, tocolor(44, 44, 44, 255), true) -- Nos Show dxDrawRectangle(x*1305, y*814, x*126/10*10*nitro, y*23, tocolor(0, 70, 149, 255), true) -- Nos Show dxDrawText((math.floor(nitro/1*100)).."% Nitro", x*1290, y*810, x*1454, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Nos Show else dxDrawText("No Nitro", x*1290, y*810, x*1454, y*842, tocolor(255, 255, 255, 255), 1.30, "default-bold", "center", "center", false, false, true, false, false) -- Nos Hide end end end addEventHandler("onClientRender", root, nitroShow)
  21. Edited a bit and tested with a real-life player (woah ). Everything works perfect, also optimized a bit as you suggested @IIYAMA.
  22. It just refused to work without a slight delay after the map has started OK, I'll try to fix it up a bit after dinner and report back soon. PS: i just saw there's no need to trigger client event on login logout and namechange will just put licence plate function in server side.
  23. Thanks for your input @IIYAMA but setTimer says: timesToExecute: The number of times you want the timer to execute, or 0 for infinite repetitions. And I set it to '1' so that it executes just once on every map start. Am I missing something? Shouldn't it be '0' to be an infinite timer?
×
×
  • Create New...