Jump to content

Teams texts with dxDrawText


SoiiNoob

Recommended Posts

like

fail example:

function createText () 
local taxi = getTeamName ("teamtaxi") 
dxDrawText (taxi, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) 
end 
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) 

Edited by Guest
Link to comment
local width,height = guiGetScreenSize() 
function createText(player) 
local player = localPlayer 
local playerTeam = getPlayerTeam(player) 
local team = getTeamName(playerTeam) 
    if ( team ) then 
        dxDrawText ("Team: "..team.."", width - 210, height - 41, width, height, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) 
    else 
        dxDrawText ("Team: None", width - 210, height - 41, width, height, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) 
    end 
end 
addEventHandler ( "onClientRender", root, createText ) 
addEventHandler( "onClientResourceStart", resourceRoot, createText ) 

https://wiki.multitheftauto.com/wiki/GuiGetScreenSize

https://wiki.multitheftauto.com/wiki/GetPlayerTeam

Link to comment

Oh it will work, but it should be:

local width,height = guiGetScreenSize() 
function createText() 
local playerTeam = getPlayerTeam(localPlayer) 
if playerTeam then 
local team = getTeamName(playerTeam) 
        dxDrawText ("Team: "..team, width - 210, height - 41, width, height, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) 
else 
        dxDrawText ("Team: None", width - 210, height - 41, width, height, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) 
    end 
end 
addEventHandler ( "onClientRender", root, createText ) 

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