Jump to content

Lpsd

Administrators
  • Posts

    317
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Lpsd

  1. Yes, the example on https://luac.multitheftauto.com/api/ only works with 1 file. You can easily edit those examples to compile a whole folder. Anyway, this resource was suggested in a topic I saw similar to this a few days ago, try it out - https://community.multitheftauto.com/index.php?p=resources&s=details&id=9219
  2. @orcun99 This topic is 7 years old. Furthermore this 'resource' was simply a line of code taken from the Wiki, which has since been updated with a more in-depth example. Check it out https://wiki.multitheftauto.com/wiki/PlaySound
  3. you're missing a comma setElementData(match "ing.own", specid)
  4. http://gtaforums.com/topic/273217-3dsmax-radiosity-advanced-lighting/
  5. Lpsd

    [HELP] Server Please !

    and a screenshot of your /server/mods/deathmatch folder?
  6. No problem Also, if I had to guess what the original error means (chunk has too many syntax levels), its because you are doing something similar to this, but with setTimer: if 1 then if 2 then if 3 then ... if 99 then if 100 then if 101 then --chunk has too many syntax levels end end end ... end end end not a good practice imo
  7. Here's a small example local lyrics = { {time=2000,words="This is the first line"}, --These lyrics show for 2000ms (2 seconds), then moves to next. {time=1000,words="Second line"}, --Same again here, they show for 1000ms (1 second) then moves to next {time=5000,words="Some more awesome lyrics"}, {time=3500,words="I like turtles"} } local currentLyric = 0 local tick function renderLyrics() local currentLyricTime = lyrics[currentLyric].time --How long should the current lyric display for? if getTickCount() > tick+currentLyricTime then --Is it time to move to the next lyric? tick = getTickCount() --If so, reset the tick count for current lyric if currentLyric < #lyrics then --Are there any more lyrics left to display? currentLyric = currentLyric + 1 --If so, move to next lyric in table else currentLyric = 0 --Else, we reset everything and stop rendering lyrics tick = nil removeEventHandler("onClientRender", root, renderLyrics) return end end --do dxDrawText here with lyrics[currentLyric].words (the current lyrics that should be displayed) end function startLyrics() --Call this to start the lyrics currentLyric = 1 --Start lyrics at line 1 tick = getTickCount() --Get the tick count when current lyric starts addEventHandler("onClientRender", root, renderLyrics) end I haven't tested, its just a general idea for you to simplify this. What you're doing seems way too over complicated, even without seeing code.
  8. Lpsd

    RAM Hogs

    I assume you've checked out the performancebrowser?
  9. That's a bad way to do it. Instead of each word inside a function, store your words/lyrics in a table and have 1 render function which works out by getTickCount (or timers) which lyric to show on the screen. Much easier and not to mention more efficient.
  10. Possibly something to do with adding so many onClientRender events? Just out of interest, why do you need so many different render events? It seems incredibly inefficient. Why not just have 1 render event and use timers to know which lyrics to show on screen
  11. You're still doing it wrong, try like this and it should work local weaponID = getPedWeapon(localPlayer) outputDebugString (weaponID) if weaponID == 44 or weaponID == 45 then local WeaponIcon = dxDrawImage (1360/dX*jX, 70/dY*jY, 200/dX*jX, 100/dY*jY, "assets/images/weapons/"..tonumber(weaponID)..".png") else outputDebugString ("else") end You want to check if the current weapon ID is X or Y You are currently trying to check if the currently weapon ID is not X and Y, which will never be true because a variable can't be two different values at the same time
  12. As I understand it you've got two 'bars' there, which I'll assume represent health and armor. I can give you an example of how I would work out all of my Dx positions; local sX, sY = guiGetScreenSize() local mainWidth,mainHeight = 300, 50 --Main size for everything local mainX, mainY = (sX / 2) - (mainWidth / 2), (sY / 2) - (mainHeight / 2) --Main position for everything. local healthW, healthH = (mainWidth / 2), (mainHeight / 2) --Work out the sizes for the health bar, based off the main sizes local armorW, armorH = (mainWidth / 2), (mainHeight / 2) --Same for the armor bar local healthX, healthY = mainX, mainY --Work out the position for the health bar, based off the main positions local armorX, armorY = mainX + (mainWidth / 2), mainY --Same for the armor bar dxDrawRectangle(mainX, mainY, mainWidth, mainHeight, tocolor(0,0,0)) dxDrawRectangle(healthX, healthY, healthWidth, healthHeight, tocolor(255,0,0)) dxDrawRectangle(armorX, armorY, armorWidth, armorHeight, tocolor(0,0,255)) To do an outline, you'd just have to do this: local outlineThickness = 1 local outlineTopX, outlineTopY = mainX, mainY-outlineThickness local outlineTopWidth, outlineTopHeight = mainWidth, outlineThickness local outlineBottomX, outlineBottomY = mainX, mainY+mainHeight local outlineBottomWidth, outlineBottomHeight = mainWidth, outlineThickness local outlineLeftX, outlineLeftY = mainX-outlineThickness, mainY local outlineLeftWidth, outlineLeftHeight = outlineThickness, mainHeight local outlineRightX, outlineRightY = mainX+mainWidth, mainY local outlineRightWidth, outlineRightHeight = outlineThickness, mainHeight dxDrawRectangle(outlineTopX, outlineTopY, outlineTopWidth, outlineTopHeight, tocolor(255,255,255)) dxDrawRectangle(outlineBottomX, outlineBottomY, outlineBottomWidth, outlineBottomHeight, tocolor(255,255,255)) dxDrawRectangle(outlineLeftX, outlineLeftY, outlineLeftWidth, outlineLeftHeight, tocolor(255,255,255)) dxDrawRectangle(outlineRightX, outlineRightY, outlineRightWidth, outlineRightHeight, tocolor(255,255,255)) This might seem like a lot more work and code, but trust me - it's so much cleaner and more importantly easy to manage since everything is based directly from two main positions & sizes. The main principle is to work out the positions for everything based off the main / parent ones. Makes it a hell of a lot easier if you decide the whole gui needs moving position. I haven't tested this, just a quick example. Hope it helps
  13. -- weap icon local weaponName = getPedWeapon(localPlayer) outputDebugString (weaponName) if tostring(weaponName) == "44" or tostring(weaponName) == "45" then local WeaponIcon = dxDrawImage (1360/dX*jX, 70/dY*jY, 200/dX*jX, 100/dY*jY, "assets/images/weapons/"..tonumber(fegyverid)..".png") else outputDebugString ("else") end This would be a better way to do it. However, if you want to check if something isn't true, you do it like so: if not a == 1 then --a is not 1 else --a is 1 end You were doing it like this: if a == not 1 then --a is equal to false 1 (?) else --will always return else due to incorrect if statement end
  14. local remaining, executesRemaining, totalExecutes = getTimerDetails(timer) -- Get the timers details local s = remaining/1000 local clock = string.format("%.2d:%.2d", s/60%60, s%60) something like that
  15. I think isBrowserLoading would be better than a timer
  16. Lpsd

    Help

    https://luac.multitheftauto.com/
  17. Lpsd

    Shooter

    The Wiki provides a perfect example https://wiki.multitheftauto.com/wiki/CreateProjectile Use that in combination with what I told you - should be easy to make
  18. Lpsd

    Shooter

    Without any examples of your code it's pretty hard to help you. Are you using a shooter system already, or are you wanting to make one?
  19. Lpsd

    Shooter

    getPedOccupiedVehicle getElementModel if getElementModel(vehicle) == vehicleID then -- if player has vehicleID else -- if player does not have vehicleID end https://wiki.multitheftauto.com/wiki/Vehicle_IDs That should help
  20. FireC.lua addEvent("FireServer.rootFireCreate",true) addEventHandler("FireServer.rootFireCreate",getRootElement(),function(rand) local fire = createFire(FirePositions[rand][1], FirePositions[rand][2], FirePositions[rand][3], FirePositions[rand][4]) fireElement[#fireElement + 1] = fire outputChatBox(FirePositions[rand].name.." is on fire!") --output to chatbox the name of location end) FireG.lua FirePositions = { -- X, Y, Z, Range(FireSize) [1] = {2114.1240234375, -1756.2508544922, 13.3984375, 800, name = "Location Name"}, --include name of location }
  21. Lpsd

    Timer

    yes but you would still at the least need a timer to update the label every second. You might aswell just use dxDrawText in onClientRender - imo its the best way
  22. You could use a script similar to this function downloadGUI() --display some GUI end addEventHandler("onClientRender", root, downloadGUI) function checkTransfer() if isTransferBoxActive() == true then setTimer(checkTransfer,2000,1) -- Check again after 2 seconds else removeEventHandler("onClientRender", root, downloadGUI) end end addEventHandler("onClientResourceStart",resourceRoot,checkTransfer) Make sure you take a look at "download_priority_group" in your meta.xml, so that this script downloads and starts before everything else! https://wiki.multitheftauto.com/wiki/Meta.xml
  23. function mySpawnVehicle(x,y,z,VehicleName) id = getVehicleModelFromName(VehicleName) spawnVeh = spawnVehicle (id, -2322.58496, -1622.78491, 483.70908) end addEvent("onSpawnVehicle", true) addEventHandler("onSpawnVehicle",getRootElement(),mySpawnVehicle) Don't overwrite function names unless you know what you are doing.
  24. Lpsd

    [HELP] Save

    @DonOmar that doesn't save anything, it simply turns a table into JSON format. If the resource restarts then you've lost the data.
×
×
  • Create New...