Jump to content

TDM Script - Player Count Does'nt Work


Recommended Posts

Well There Is No Errors But When i Join The Team It Does'nt Say There Is 1 Player On The Team

Client:

addEvent("tdmstart", true) 
addEventHandler("tdmstart",root, 
function() 
addEventHandler("onClientRender", root, drawthetext) 
end) 
  
function drawthetext() 
    local redteamname = getTeamFromName("Red Team") 
    local blueteamname = getTeamFromName("Blue Team") 
    local redp = countPlayersInTeam( redteamname ) 
    local bluep = countPlayersInTeam( blueteamname ) 
    local screenWidth, screenHeight = guiGetScreenSize() 
    local ax, ay = screenWidth - 90, 200 
    local ax1, ay1 = screenWidth - 92, 180   
    dxDrawText("Red Team: "..tostring(redp), ax,ay) 
    dxDrawText("Blue Team: "..tostring(bluep), ax1,ay1) 
end 
  
addEvent("stoptdm",true) 
addEventHandler("stoptdm",root, 
function() 
    removeEventHandler("onClientRender", root, drawthetext) 
end 
) 

Server (Team Join Commands ) :

addCommandHandler("joinredteam", 
function(thePlayer, commandName) 
    setPlayerTeam(thePlayer, "Red Team") 
    outputChatBox("You are on the Red Team.",thePlayer) 
    end 
) 
  
addCommandHandler("joinblueteam", 
function(thePlayer, commandName) 
    setPlayerTeam(thePlayer, "Blue Team") 
    outputChatBox("You are on the Blue Team.",thePlayer) 
    end 
) 

Link to comment

Thanks How Can I Set The Whole Server To No Team When i type a command?

addCommandHandler("noteam", 
function(thePlayer) 
outputChatBox("All Players is now without team.",thePlayer) 
for _, player in ipairs(getElementsByType("player")) do 
          setPlayerTeam(player, nil) 
     end 
end) 

Link to comment

Thanks How Can I Set The Whole Server To No Team When i type a command?

addCommandHandler("noteam", 
function(thePlayer) 
outputChatBox("All Players is now without team.",thePlayer) 
for _, player in ipairs(getElementsByType("player")) do 
          setPlayerTeam(player, nil) 
     end 
end) 

how can i set the teams to be fair like auto assign how can i check if the teams are equal

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