• Net message not sending as intended
    2 replies, posted
When I run this command cl_init [code]concommand.Add("testnet3", function() RunConsoleCommand("printmodel") net.Receive( "test", function() reads = net.ReadString() print(reads) end ) end)[/code] init [code] concommand.Add("printmodel", function(ply) npcmodel = sql.QueryValue( "SELECT model from pkmn12 WHERE SteamID = '".. ply:SteamID() .."' " ) print(npcmodel) util.AddNetworkString("test") net.Start("test") net.WriteString( npcmodel) net.Send(ply) end)[/code] It will return models/player/kleiner.mdl but only server side. If I run it again it will return models/player/kleiner.mdl server side and client side. I want to be able to run it just once and for models/player/kleiner.mdl to show up clientside and server side. Is there a work around or am I doing something wrong?
[QUOTE=auri45;51607591]When I run this command cl_init [code]concommand.Add("testnet3", function() RunConsoleCommand("printmodel") net.Receive( "test", function() reads = net.ReadString() print(reads) end ) end)[/code] init [code] concommand.Add("printmodel", function(ply) npcmodel = sql.QueryValue( "SELECT model from pkmn12 WHERE SteamID = '".. ply:SteamID() .."' " ) print(npcmodel) util.AddNetworkString("test") net.Start("test") net.WriteString( npcmodel) net.Send(ply) end)[/code] It will return models/player/kleiner.mdl but only server side. If I run it again it will return models/player/kleiner.mdl server side and client side. I want to be able to run it just once and for models/player/kleiner.mdl to show up clientside and server side. Is there a work around or am I doing something wrong?[/QUOTE] You should read up on [URL="https://wiki.garrysmod.com/page/Net_Library_Usage"]this[/URL], You probably didn't 'register' the network string.
[QUOTE=Amic;51607639]You should read up on [URL="https://wiki.garrysmod.com/page/Net_Library_Usage"]this[/URL], You probably didn't 'register' the network string.[/QUOTE] Thanks, turns out I had to register the network string outside of the function.
Sorry, you need to Log In to post a reply to this thread.