Jump to content

Bilal135

Members
  • Content Count

    842
  • Joined

  • Last visited

Everything posted by Bilal135

  1. This should do the job. (Not tested) local vehicle = {}; function isVehicleOccupied(vehicleID) if vehicle[vehicleID] = true then return true end return false end function createVehicleForPlayer(player, cmd, model) if not tonumber(model) then return false end if isVehicleOccupied(model) then return false end local x, y, z = getElementPosition(player) local veh = createVehicle(model, x + 5, y, z) if not veh then return false end vehicle[model] = true; end addCommandHandler("vh", createVehicleForPlayer) function destroyVehicleOnQuit(player) if not isPedInVehicle(player) then re
  2. I don't know about others but I use GUI editor from the community.
  3. I figured it out. Thank you @IIYAMA
  4. local crewData = {}; function createCrew(crew, tag, r, g, b) if not tostring(crew) or not tostring(tag) or not tonumber(r) or not tonumber(g) or not tonumber(b) then return outputDebugString("* createCrew: Wrong args.", 1) end if doesCrewExist(crew) then return outputDebugString("* createCrew: Crew already exists.", 1) end crewData[crew] = { Members = {}, crewTag = tag, Color = {r, g, b}, Leader = {}, Experience = 0, }; outputDebugString(crew.." successfully created.") return crew end -- getPlayerCrew fun
  5. I'm trying to add an image in scoreboard but i'm getting this error: https://imgur.com/a/XCIx2F9 this is the line in dxscoreboard_client.lua: dxDrawImage ( topX+theX, y, itemWidth, itemHeight, content.src, content.rot, content.rotOffX, content.rotOffY, content.color, drawOverGUI ) and this is what im doing, setElementData(source, "Rank", {type = "image", src="admin.png"}) Thanks.
  6. Is it possible to change the colour of a smoke that is created by createObject? E.g object ID 2780 is smoke but its white, any way to change its colour?
  7. I have heard that inserting players in a new table with 'for i = 1, #playerTable' method reduces the time it takes for the loop to complete, as compared to the more common 'for k, v in ipairs / pairs' loop. I know that the first method is more efficient from Lua guides, but I fail to understand the logic behind it. In the case of the common loop, it would directly iterate over the table returned by getElementsByType. As for the for i = 1 method, we would first have to add the contents of the table (returned by getElementsByType) in a new indexed table, in this instance, playerTable, and t
  8. Show where this table is implemented in the code
  9. Debug your code. xml = xmlLoadFile("cars/saved.xml") if xml then print("File is loaded") else print("File is NOT loaded") end
  10. If you have added that in meta.xml, what does the debugscript output?
  11. Probably create an export function that returns the desired xml file. @stPatrick oh I didn’t know that was even possible
  12. Lol I thought you were trying to load a file from a different folder within the same script.
  13. <file src="folder/filename.xml"/> xml = xmlLoadFile("folder/filename.xml")
  14. Perhaps, what you're looking for is dxDrawImageOnElement.
  15. I loved how you introduced the features in a humorous way. Great to see original content in MTA Roleplay after such a long period of rip offs. Good luck, @Blast3r.
  16. @IIYAMA, ah yes, i misunderstood. He might have wanted to trigger the event somewhere else.
  17. From what I have come to understand is, when you type 'test', you want to create an object, and if it already exists, then delete it. Imo you don't even need an event to do that, but if you want to do it your way, it would be better to pass the object as an argument to the trigger event. local obj addEventHandler("test", function(plr, cmd) if not isElement(obj) then obj = createObject(1234, getElementPosition(plr)) -- spawn object with '1234' id at our current position. else triggerEvent("deleteObject", obj) end end) addEvent("deleteObject", true) addEventHand
  18. Line 20: Replace m_dthru with m_dthru[index]. You may also want to make sure that r, g, b, and a are defined, and for the sake of testing, remove -1 from third arg of createMarker, just to make sure that isn't causing any problem. If it still does not work, try running the script server side. (Don't forget to change the outputChatBox arguments in this case)
  19. Check if this works. local drivethru = { {2376.21, -1908.87, 13.11}, {2409.42, -1488.03, 23.56}, {789.30, -1619.01, 13.11} } function usunGui() outputChatBox("test2") end function triggerujKupno() outputChatBox("test") end local index = 1; local m_dthru = {}; for k,v in ipairs(drivethru) do m_dthru[index] = createMarker(v[1], v[2], v[3]-1, "cylinder", 2.0, 255, 255, 0, 200) createBlipAttachedTo(m_dthru, 17, 1, r, g, b, a, 0, 300) index = index + 1; end addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension) if (source ==
  20. Try this, local drivethru = { {2376.21, -1908.87, 13.11}, {2409.42, -1488.03, 23.56}, {789.30, -1619.01, 13.11} } function usunGui() outputChatBox("test2") end function triggerujKupno() outputChatBox("test") end local index = 1; local m_dthru = {}; for k,v in ipairs(drivethru) do m_dthru[index] = createMarker(v[1], v[2], v[3]-1, "cylinder", 2.0, 255, 255, 0, 200) createBlipAttachedTo(m_dthru, 17, 1, r, g, b, a, 0, 300) addEventHandler("onMarkerLeave", m_dthru[index], usunGui, false) addEventHandler("onMarkerHit", m_dthru[index], triggerujKupno, false
  21. As far as I know, there is no limit to the resources that you can run on a local server, and even if we assume that there was one, it would be much higher than 20. Your problem is certainly a very unusual one. Make sure that the new resources which you added have the correct meta.xml, and each resource does not have its files in sub folders.
×
×
  • Create New...