Jump to content

scoreboard flag


orcun99

Recommended Posts

I add this code in scoreboard dxscoreboard_client.lua line 705


		elseif column.name == "Home" then 
  dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) 

 

and my script

exports.a:addScoreboardColumn('Home') 
  
function showcountry() 
local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
    setElementData(source,"Home",":admin/client/images/flags/"..flag..".png") 
    else 
    flag = "N/A" 
    
    end 
end 
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

 

but don't work

 

exports.a:addScoreboardColumn('Home')    a = my score board script

Edited by orcun99
Link to comment

It really doesn't work that way, the scoreboard doesn't magically know that it's supposed to draw an image.

Do something like this instead:

exports.a:addScoreboardColumn('Home') 
  
function showcountry() 
local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
	setElementData(source,"Home", {type = "image", src = ":admin/client/images/flags/"..flag..".png"}) 
    else 
	flag = "N/A" --What's this for? It's never used.
    end 
end 
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

 

Edited by MIKI785
Link to comment
12 minutes ago, MIKI785 said:

It really doesn't work that way, the scoreboard doesn't magically know that it's supposed to draw an image.

Do something like this instead:


exports.a:addScoreboardColumn('Home') 
  
function showcountry() 
local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
	setElementData(source,"Home", {type = "image", src = ":admin/client/images/flags/"..flag..".png"}) 
    else 
	flag = "N/A" --What's this for? It's never used.
    end 
end 
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

 

still don't work 

 

pic scoreboard: https://prntscr.com/ie8b8i

no debug

 

and my flags localtion is : C:\Users\whoami\Desktop\mta server 25.11.2017\mods\deathmatch\resources\[admin]\admin\client\images\flags

Edited by orcun99
Link to comment

Use /debugscript 3, and tell us

Use this server-side on your script

function showcountry()
    local flag = exports.admin:getPlayerCountry ( source )
        if flag then
        setElementData(source,"Country",":admin/client/images/flags/"..flag..".png")
        else
        flag = "N/A"
       
        end
    end
    addEventHandler("onPlayerJoin",getRootElement(),showcountry)

add it on admin panel, use resource."yourfoldername"

and use this scoreboard code

elseif column.name == "Country" then
dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI )

That should 100% work, because I tested it

PS: do not forget to add this on scoreboard exports

	{ ["name"] = "Country", ["width"] = 16, ["friendlyName"] = "Country", ["priority"] = 1 }, --add your placement instead of "1"

Tell me if you got a problem

Link to comment
1 hour ago, TorNix~|nR said:

Use /debugscript 3, and tell us

Use this server-side on your script


function showcountry()
    local flag = exports.admin:getPlayerCountry ( source )
        if flag then
        setElementData(source,"Country",":admin/client/images/flags/"..flag..".png")
        else
        flag = "N/A"
       
        end
    end
    addEventHandler("onPlayerJoin",getRootElement(),showcountry)

add it on admin panel, use resource."yourfoldername"

and use this scoreboard code


elseif column.name == "Country" then
dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI )

That should 100% work, because I tested it

PS: do not forget to add this on scoreboard exports


	{ ["name"] = "Country", ["width"] = 16, ["friendlyName"] = "Country", ["priority"] = 1 }, --add your placement instead of "1"

Tell me if you got a problem

so thanks for your helps

but I still have problem  so you can see

myscript name : "ulke"     

acl is okay? : http://prntscr.com/ie9kjc

and ulke:  server side

exports.a:addScoreboardColumn('Country') 
function showcountry()
    local flag = exports.admin:getPlayerCountry ( source )
        if flag then
        setElementData(source,"Country",":admin/client/images/flags/"..flag..".png")
        else
        flag = "N/A"
       
        end
    end
    addEventHandler("onPlayerJoin",getRootElement(),showcountry)

there is no client side 

meta:

<meta>
	<info author="x" name="Country Script" version="1.0.0" type="script"/>
	
	<script src="server.lua" type="server" />
</meta>

this is  dxscoreboard_client.lua : http://prntscr.com/ie9mba

and exports: https://prnt.sc/ie9o7w

ingame and debugscript3 there no error about this script: https://prnt.sc/ie9p07

still can't see flag

what's wrong :(

Edited by orcun99
Link to comment

The file names are lower case.

exports.a:addScoreboardColumn('Home') 
  
function showcountry() 
local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
	setElementData(source,"Home", {type = "image", src = ":admin/client/images/flags/"..string.lower(flag)..".png"}) 
    else 
	flag = "N/A" --What's this for? It's never used.
    end 
end 
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

 

Link to comment
18 minutes ago, MIKI785 said:

The file names are lower case.


exports.a:addScoreboardColumn('Home') 
  
function showcountry() 
local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
	setElementData(source,"Home", {type = "image", src = ":admin/client/images/flags/"..string.lower(flag)..".png"}) 
    else 
	flag = "N/A" --What's this for? It's never used.
    end 
end 
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

 

already all lower case I send u private message can u check ?

Edited by orcun99
Link to comment
 function showcountry() 
local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
	setElementData(source,"Home", {type = "image", src = ":admin/client/images/flags/"..string.lower(flag)..".png"}) 
	outputChatBox("1")
    else
  setElementData(source,"Home","N/A")
  	outputChatBox("2")
    end 
end 
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

when i reconnect   message 2 ... and N/A don't work

I think problem : exports.admin:getPlayerCountry ( source )

Edited by orcun99
Link to comment

wait

19 minutes ago, orcun99 said:

 function showcountry() local flag = exports.admin:getPlayerCountry ( source )     if flag then 	setElementData(source,"Home", {type = "image", src = ":admin/client/images/flags/"..string.lower(flag)..".png"}) 	outputChatBox("1")    else  setElementData(source,"Home","N/A")  	outputChatBox("2")    end end addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

when i reconnect   message 2 ... and N/A don't work

I think problem : exports.admin:getPlayerCountry ( source )

and no that's not the problem

Link to comment
15 minutes ago, ÆBKV said:

wait

and no that's not the problem

uh there is debug :  dxscoreboard_client.lua:699 badargument dxdrawImage  [Expected material at argument 5 ,got table]

 

line699: dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI )

Edited by orcun99
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...