-
Posts
843 -
Joined
-
Last visited
-
Days Won
1
Bilal135 last won the day on July 4 2022
Bilal135 had the most liked content!
About Bilal135
- Birthday 30/06/2002
Details
-
Gang
Nightwalkers
-
Location
Pakistan
-
Occupation
Chick sexer
-
Interests
Scripting
Recent Profile Visitors
3,927 profile views
Bilal135's Achievements
Road Dawg (33/54)
16
Reputation
-
Try this, addEventHandler ( "onClientMarkerHit", root, function ( hitElement ) if source == marker then if ( hitElement == localPlayer and getElementType ( hitElement ) == "player" ) then outputChatBox("working") destroyElement(marker) end end end )
-
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 return false end local veh = getPedOccupiedVehicle(player) if not veh then return false end local model = getElementModel(veh) if not isVehicleOccupied(model) then return false end if not isElement(veh) then return false end destroyElement(veh) vehicle[model] = false; end addEventHandler("onPlayerQuit", root, destroyVehicleOnQuit)
-
Bilal135 changed their profile photo
-
I don't know about others but I use GUI editor from the community.
-
I figured it out. Thank you @IIYAMA
-
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 function getPlayerCrew(player) if not player then return outputDebugString("* getPlayerCrew: Wrong args.", 1) end local account = getPlayerAccount(player) if isGuestAccount(account) then return false end local accountName = getAccountName(account) for k, v in pairs(crewData) do for k1, v1 in pairs(crewData[v].Members) do -- Error: attempt to index field '?' (a nil value) if v1 == accountName then return v end end end return false end -- addPlayer function addPlayer(player, crew) if not player or not tostring(crew) then return outputDebugString("* addPlayer: Wrong args.", 1) end local account = getPlayerAccount(player) local accountName = getAccountName(account) if isGuestAccount(account) then return end if getPlayerCrew(player) then return end -- getPlayerCrew is called here. table.insert(crewData[crew].Members, accountName) return true end I've been scratching my head over this error for a while now. crewData[v]. Members should not be nil. I've tested that by adding a few test strings in Members table (in addPlayer function), and then by this command. It does output the strings, but still gives error when getPlayerCrew is called. function listMembers(player, cmd, crew) for k, v in pairs(crewData[crew].Members) do outputChatBox(v, root) end end addCommandHandler("fmem", listMembers) Thanks.
-
It does exist and its in meta.xml..
-
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.
-
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?
-
That sums it up. Thank you.
-
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 then we would loop over it once again to get the players in it. I wrote the following code to compare the time it takes to finish each type of iteration. However, both results were 0. Perhaps, it is because the difference is so minute that the machine is not able to identify it? If that's so, whats the point of preferring the first type over the second, when the difference is barely noticeable? local players = getElementsByType("player"); local playerTable = {}; local sT = getTickCount(); -- Supposed to be a faster way? for i = 1, #players do playerTable[i] = players; -- Insert players in a new indexed table. outputChatBox(getPlayerName(playerTable[i][1]), root); local eT = getTickCount(); outputChatBox(eT - sT, root); -- Output: 0 end -- Compared to the more common loop for k, v in ipairs(players) do outputChatBox(getPlayerName(v, root)); -- Directly access the contents of the table. local endTime = getTickCount(); outputChatBox(endTime - sT, root); -- Output: 0 end EDIT: I realised there is no need to insert the players in a new indexed table. (Still the same output) for i = 1, #players do outputChatBox(getPlayerName(players[i]), root); local eT = getTickCount(); outputChatBox(eT - sT, root); -- Output: 1 end -- Compared to the more common loop for k, v in ipairs(players) do outputChatBox(getPlayerName(v, root)); -- Directly access the contents of the table. local endTime = getTickCount(); outputChatBox(endTime - sT, root); -- Output: 1 end Why is the first sort of iteration faster? Would the difference be even larger, if the number of players were extraordinarily large? If that's the case, I'd understand why we would want to use the first loop over the second.
-
Show where this table is implemented in the code
-
If you have added that in meta.xml, what does the debugscript output?
-
Probably create an export function that returns the desired xml file. @stPatrick oh I didn’t know that was even possible