1. Post #1
    Dwight's Avatar
    January 2011
    51 Posts
    init.lua
    function SendTeamOne()
     TEAMoneNPC = #ents.FindByName( "TEAM1" )
     umsg.Start("TEAMONE");
     umsg.String(TEAMoneNPC);
     umsg.End();
    end
    
    function SendTeamTwo()
     TEAMtwoNPC = #ents.FindByName( "TEAM2" )
     umsg.Start("TEAMTWO");
     umsg.String(TEAMtwoNPC);
     umsg.End();
    end
    

    cl_init.lua
     function Score()
    	function ReciveTeamOne( um )
    	 aliveNPCs1 = ( um:ReadString() )
    	end
    usermessage.Hook("TEAMONE", ReciveTeamOne );
    	function ReciveTeamTwo( um )
    	 aliveNPCs2 = ( um:ReadString() )
    	end
    usermessage.Hook("TEAMTWO", ReciveTeamTwo );
     
     draw.SimpleText("Bleu: "..tostring( aliveNPCs1 ).."  --  ".."Red: "..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)
    

    In never sends or in never reloads..
    Someone knows how to fix this?
    Or what i'm doing wrong?

    this is the result:


    Thanks,

  2. Post #2
    "The superior man understands what is right; the inferior man understands what will sell"
    Chessnut's Avatar
    August 2011
    3,514 Posts
    You only need to hook the message once. You need to update the variable by calling the function that does more than once.

  3. Post #3
    Dwight's Avatar
    January 2011
    51 Posts
    Oh!
    Now i got it!


    Thanks Chessnut!!