[LUA]
function Score()
aliveNPCs1 = #ents.FindByName( "TEAM1" )
aliveNPCs2 = #ents.FindByName( "TEAM2" )
draw.SimpleText("Team1: "..tostring( aliveNPCs1 ).." -- ".."Team2: "..tostring( aliveNPCs2 ) , "ScoreboardText", ScrW() / 2 - 30, ScrH() - 650, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
hook.Add("HUDPaint","ScoreShow",Score)
[/LUA]
This is my code, it is for my gamemode and has put in cl_ini.lua
but the hud always stand on 0 for both teams ...
if there are 10 entitis with the name TEAM1, the hud still says 0 ...
Someone know how to fix this?
Thanks!
Are you really sure that your npc's are spawning with those names?
init.lua
[LUA]
function ISaid( ply, text, team )
local aliveNPCs1 = #ents.FindByName( "TEAM1" )
local aliveNPCs2 = #ents.FindByName( "TEAM2" )
if (string.sub(text, 1, 2) == "//") then
for k, v in ipairs( player.GetAll() ) do
v:PrintMessage( HUD_PRINTTALK, "The Blue Team Has " .. tostring( aliveNPCs1 ) .. " NPC's, The Red Team Has " .. tostring( aliveNPCs2 ) .. " NPC's." )
end
end
end
hook.Add( "PlayerSay", "ISaid", ISaid );
[/LUA]
This code works perfect.
But when i want to set it in a hud.. not...
Names aren't networked automatically, you have to do it yourself.
Sorry, you need to Log In to post a reply to this thread.