Jump to content

dxDrawtext issue


h4x7o0r

Recommended Posts

Hi there, here's part of the client side code. I wanna change the way that teams, alive players are shown.

For example, the following code is working well but it's rendering those dxdraw's like this :

Team1

Team5

What i want is to have 2 different dxDrawtext for every single team .

Here's the client code:

  
local funRound = true 
  
function onOffFunRound (state) 
funRound = state 
end 
  
function showCountTeams () 
if showTeams and addedTeams[2] then 
local textTeam = "" 
local textCount = "" 
local textAlives = "" 
    if funRound then 
    --dxDrawRectangle ( 0, 0, x, y , tocolor (0, 0, 0, 50)) 
    dxDrawText("Free Round", x - 141, (y/5.65)-14, x, y, tocolor(255, 0, 0, 255), 1.3, 'default-bold') 
    end 
    for i, team in ipairs (addedTeams) do 
    textCount = textCount..countTable[getTeamName(team)].."\n" 
        if alivept[getTeamName(team)] and not funRound then textAlives = " ("..alivept[getTeamName(team)]..")" end 
    textTeam = textTeam..string.format("#%.2X%.2X%.2X", getTeamColor(team))..getTeamName(team)..textAlives.."\n" 
    end 
dxDrawRectangle ( x - 190, (y/5.65)-14, 200, (20+14*#addedTeams) , tocolor ( 0, 0, 0, 50 ) ) 
dxDrawRectangle ( x - 190, y/5.5, 200, (20+14*#addedTeams) , tocolor ( 0, 0, 0, 150 ) ) 
dxDrawText(textCount, x - 185, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold') 
dxDrawText (textTeam,  x - 175, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true) 
end 
end 
addEventHandler ( "onClientRender", root, showCountTeams ) 
  
  

I don't really know how to trigger those teams

  
-- Something like this  
dxDrawText (textTeam(1),  x - 175, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true) 
dxDrawText (textTeam(2),  x - 375, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true) 
  

Link to comment

i don't know how to retrieve team1 from addedteams

  
    -- wanna replace this textTeam(1) with the right syntax (tried : addedTeams[1] already but doesn't work) 
    dxDrawText (textTeam(1),  x - 175, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true) 
  

Link to comment
dxDrawText ( addedTeams [ 1 ],  x - 175, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true ) 
dxDrawText ( addedTeams [ 2 ],  x - 375, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true ) 

Link to comment
dxDrawText ( getTeamName ( addedTeams [ 1 ] ),  x - 175, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true ) 
dxDrawText ( getTeamName ( addedTeams [ 2 ] ),  x - 375, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true ) 

Link to comment

Thank you for your help, it's working well but i can't add the rest of the parameters.

by default using the code provided before, if there are 2 teams already created it shows :

0 TEAM1 (2)

5 TEAM2 (2)

0 = teampoints

TEAM1 = teamname

(2) = alive players

and so on . Using your code it shows only : TEAM1. How can i use the parameters as a string ?

what i need is to use values from textTeam; textCount and textAlive.

Link to comment
dxDrawText ( getTeamName ( addedTeams [ 1 ] ) .." (".. alivept [ getTeamName ( addedTeams [ 1 ] ) ] ..")",  x - 175, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true ) 
dxDrawText ( getTeamName ( addedTeams [ 2 ] ) .." (".. alivept [ getTeamName ( addedTeams [ 2 ] ) ] ..")",  x - 375, (y/5.65)+13, x, y, tocolor(255, 255, 255, 255), 1.05, 'default-bold', "left", "top", false, false, false, true ) 

That may show the alive players, but about points, no idea, is your script, you should know how it works.

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...