Alright so I got all this code and I'm pretty sure its all set up right, but the problem is that it doesnt do what i want it to do, which is lock the player for 10 seconds. Is there a way to do this better or correctly if its wrong?
init
[LUA]util.AddNetworkString( "Lock" )
function Lock()
net.Receive( "Lock", function()
LocalPlayer():Lock()
end )
timer.Simple( 10, function()
LocalPlayer():UnLock()
end )
end[/LUA]
cl_init
[LUA]local shop = RunConsoleCommand("shop")
net.Start( "Lock" )
net.SendToServer()
[/LUA]
There aren't any errors either.
Do
[lua]
util.AddNetworkString("Lock")
[/lua]
Serverside, at least a few seconds before the message is sent.
[QUOTE=ms333;39605909]Do
[lua]
util.AddNetworkString("Lock")
[/lua]
Serverside, at least a few seconds before the message is sent.[/QUOTE]
I already did that in init. i just forgot to put that in the post. Thanks tho.
LocalPlayer() doesn't exists serverside
And why do you hook on a net message inside a function? Make sure it's called
I got this in init now and the cl_init is the same. [LUA]net.Receive( "Lock", function()
ply:Lock()
end )[/LUA]
I guess its progress because now all im getting is ply a nil value. :v:
[QUOTE=Triple-X;39606043]I got this in init now and the cl_init is the same. [LUA]net.Receive( "Lock", function()
ply:Lock()
end )[/LUA]
I guess its progress because now all im getting is ply a nil value. :v:[/QUOTE]
Repleace ply with LocalPlayer() in cl_init
He doesn't use the player entity client side..
And ply is not the player entity if you don't define it.
The function you give net.Receive as the second argument takes two arguments on the server: player, length. You're missing them. I won't bother telling you why it's stupid to let the client decide when to lock or unlock itself.
Sorry, you need to Log In to post a reply to this thread.