MRThinker Posted September 10, 2018 Share Posted September 10, 2018 hi guys i wank make a stats panel ! like : press F1 and show GUI and show player name, show player money, show player wanted level and more ... plz give me code or functions @MIKI785 Link to comment
MIKI785 Posted September 10, 2018 Share Posted September 10, 2018 This is not a place to request full code.. and there are far too many functions to list, it also depends on what exactly you want. Just check the GUI functions on the wiki and see what kind of elements you want to utilise. It's all documented there, the rest is straight forward.. player name? getPlayerName.. player money? getPlayerMoney... wanted level? getPlayerWantedLevel... you see the pattern yet? Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 3 minutes ago, MIKI785 said: This is not a place to request full code.. and there are far too many functions to list, it also depends on what exactly you want. Just check the GUI functions on the wiki and see what kind of elements you want to utilise. It's all documented there, the rest is straight forward.. player name? getPlayerName.. player money? getPlayerMoney... wanted level? getPlayerWantedLevel... you see the pattern yet? i know this functions... i dont know gui functions ! plz give me Link to comment
Dimos7 Posted September 10, 2018 Share Posted September 10, 2018 (edited) https://wiki.multitheftauto.com/wiki/Client_Scripting_Functions#GUI_functions_2 Edited September 10, 2018 by Dimos7 Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 1 minute ago, Dimos7 said: https://wiki.multitheftauto.com/wiki/Client_Scripting_Functions#GUI_functions_2 hi @Dimos7 i have a id system how to make a column on Scoreboard and show the ID's on that column ? Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 Just now, Dimos7 said: how me your code exports [ "scoreboard" ]:addScoreboardColumn ( "ID", getRootElement() ) function showID (player) for index, player in ipairs ( getElementsByType "player" ) do setElementData(player,"ID",getElementData(player,"id")) end end addEventHandler("onPlayerJoin",getRootElement(),showID) Link to comment
Dimos7 Posted September 10, 2018 Share Posted September 10, 2018 (edited) ID = {} exports["scoreboard"]:addScoreboardColumn("ID", root, 20, "ID", 1) ------------------------ [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 0 , getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) break end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "id", i) break end end end end) ---------------------------------- [ Fnctions ] ------------------------------------ function getPlayerID(player) if player and isElement(player) and getElementType(player) == "player" and getElementData(player, "id") then return getElementData(player, "id") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end Edited September 10, 2018 by Dimos7 Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 3 minutes ago, Dimos7 said: ID = {} exports["scoreboard"]:addScoreboardColumn("ID", root, 20, "ID", 1) ------------------------ [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 0 , getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) break end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "id", i) break end end end end) ---------------------------------- [ Fnctions ] ------------------------------------ function getPlayerID(player) if player and isElement(player) and getElementType(player) == "player" and getElementData(player, "id") then return getElementData(player, "id") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end worked but id dont showing on scoreboard ! Link to comment
#STARK Posted September 10, 2018 Share Posted September 10, 2018 replace this exports["scoreboard"]:addScoreboardColumn("ID", root, 20, "ID", 1) with this exports["scoreboard"]:addScoreboardColumn("id", root, 20, "id", 1) Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 2 minutes ago, #STARK said: replace this exports["scoreboard"]:addScoreboardColumn("ID", root, 20, "ID", 1) with this exports["scoreboard"]:addScoreboardColumn("id", root, 20, "id", 1) worked but ID showing after Name how to show ID before Name ? Link to comment
Dimos7 Posted September 10, 2018 Share Posted September 10, 2018 18 minutes ago, MRThinker said: worked but ID showing after Name how to show ID before Name ? That is impossible for me that code put the id before name Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 Just now, Dimos7 said: That is impossible for me that code put the id before name Link to comment
Dimos7 Posted September 10, 2018 Share Posted September 10, 2018 Just now, MRThinker said: You have orginal scoreboard or dx one? Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 Just now, Dimos7 said: You have orginal scoreboard or dx one? i have original scoreboard Link to comment
Dimos7 Posted September 10, 2018 Share Posted September 10, 2018 (edited) ID = {} exports["scoreboard"]:addScoreboardColumn("id", root, 20, "id", 2) ------------------------ [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 0 , getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) break end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "id", i) break end end end end) ---------------------------------- [ Fnctions ] ------------------------------------ function getPlayerID(player) if player and isElement(player) and getElementType(player) == "player" and getElementData(player, "id") then return getElementData(player, "id") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end Save it restart the resource and after change it 2 to 1 Edited September 10, 2018 by Dimos7 Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 5 minutes ago, Dimos7 said: ID = {} exports["scoreboard"]:addScoreboardColumn("ID", root, 20, "ID", 2) ------------------------ [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 0 , getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) break end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "id", i) break end end end end) ---------------------------------- [ Fnctions ] ------------------------------------ function getPlayerID(player) if player and isElement(player) and getElementType(player) == "player" and getElementData(player, "id") then return getElementData(player, "id") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end Save it restart the resource and after change it to This code not only shows the id before the name, it does not even show an id Link to comment
Dimos7 Posted September 10, 2018 Share Posted September 10, 2018 ID = {} exports["scoreboard"]:addScoreboardColumn("id", root, 20, "id", 1) ------------------------ [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 0 , getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) break end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "id", i) break end end end end) ---------------------------------- [ Fnctions ] ------------------------------------ function getPlayerID(player) if player and isElement(player) and getElementType(player) == "player" and getElementData(player, "id") then return getElementData(player, "id") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end Link to comment
MRThinker Posted September 10, 2018 Author Share Posted September 10, 2018 2 minutes ago, Dimos7 said: ID = {} exports["scoreboard"]:addScoreboardColumn("id", root, 20, "id", 1) ------------------------ [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 0 , getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) break end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "id", i) break end end end end) ---------------------------------- [ Fnctions ] ------------------------------------ function getPlayerID(player) if player and isElement(player) and getElementType(player) == "player" and getElementData(player, "id") then return getElementData(player, "id") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end id now showing or id after Name 10 minutes ago, Dimos7 said: ID = {} exports["scoreboard"]:addScoreboardColumn("id", root, 20, "id", 1) ------------------------ [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 0 , getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "id", i) break end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "id", i) break end end end end) ---------------------------------- [ Fnctions ] ------------------------------------ function getPlayerID(player) if player and isElement(player) and getElementType(player) == "player" and getElementData(player, "id") then return getElementData(player, "id") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end worked successfuly ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now