Dany Alex Posted August 30, 2016 Share Posted August 30, 2016 no errors server.lua exports.rppscoreboard:addScoreboardColumn('Home') addEventHandler("onPlayerJoin", root, function() local country = exports.admin:getPlayerCountry(source) local flag = country and ":admin/client/images/flags/"..country..".png" setElementData(source, "Home", flag and {type = "image", src = flag, height = 12, width = 16} or "N/A") end) Link to comment
idarrr Posted August 31, 2016 Share Posted August 31, 2016 You can't use table on setElementData. Read https://wiki.multitheftauto.com/wiki/Element_data Since not all datatypes can be packetized to be transferred, there are some restrictions. The types that cannot be stored as element data are non-element userdata (see MTA Classes), functions and threads. Also, you may not send tables which contain one or more values of any of these types. The best way is using triggerClientEvent. Or if you really want to use setElementData. Only attach Country on Element Data, then declare another variable on Client Side. Server Side addEventHandler("onPlayerJoin", root, function() local country = exports.admin:getPlayerCountry(source) setElementData(source, "country", country) end) Client Side local country = getElementData(localPlayer, "country") local imgpath = ":admin/client/images/flags/"..country..".png" Link to comment
Gravestone Posted August 31, 2016 Share Posted August 31, 2016 For adding the image to the scoreboard, you'll have to edit the scoreboard resource and add the image path there or you can set a different element data which describes the path and then get it using getElementData. Then add dxDrawImage in scoreboard. 1 Link to comment
idarrr Posted September 5, 2016 Share Posted September 5, 2016 Just show me your full code 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