• Networking Variables not working.
    2 replies, posted
  • Avatar of Dwight
  • init.lua [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 [/LUA] cl_init.lua [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) [/LUA] In never sends or in never reloads.. Someone knows how to fix this? Or what i'm doing wrong? this is the result: [IMG]http://i45.tinypic.com/dggrae.png[/IMG] Thanks,
  • Avatar of Chessnut
  • You only need to hook the message once. You need to update the variable by calling the function that does more than once.
  • Avatar of Dwight
  • Oh! Now i got it! [IMG]http://i49.tinypic.com/ejcw3n.png[/IMG] Thanks Chessnut!!