• Freeze function help
    9 replies, posted
Ok, when the function "stuck" is called will the player freeze? I know this is probably a total mess and is useless, but I'm just practising things :) thanks. Basically will the "player.freeze" work and if not how do I get it to work? function stuck(length) player.freeze(1) for time=1,length do msg("you're stuck for"..time.."seconds") end player.freeze(0) end
no
[QUOTE=CombineGuru;19467232]no[/QUOTE] Thanks. Very helpful. I now know what I have done wrong :)
First, there are no function called stuck... Second, use the lua tage: [lua] [/lua] Third, this will maybe help you: [lua]function FreezePly( ply ) for _, ply in ipairs( player.GetAll() ) do player:Freeze( true ) end timer.Simple( 5, player:Freeze( false ) conCommand( "ply_freeze", FreezePly )[/lua] When you will enter ply_freeze in console, it will freeze all the player, then after 5 seconds, will unfreeze them. UNTESTED!
ok thanks.
Your lua is fairly weird. for time = 1, length do will just print it length times all at once. player.Freeze takes a boolean as an argument. [editline]02:14PM[/editline] [QUOTE=bilbasio;19467511]First, there are no function called stuck... Second, use the lua tage: [lua] [/lua] Third, this will maybe help you: [lua]function FreezePly( ply ) for _, ply in ipairs( player.GetAll() ) do player:Freeze( true ) end timer.Simple( 5, player:Freeze( false ) conCommand( "ply_freeze", FreezePly )[/lua] When you will enter ply_freeze in console, it will freeze all the player, then after 5 seconds, will unfreeze them. UNTESTED![/QUOTE] This won't work either. The following will: [lua]function FreezePly( ply ) ply:Freeze( true ) timer.Simple( 5, player.Freeze, false ) end concommand.Add( "ply_freeze", FreezePly )[/lua]
Thank you for correcting my error, its actually the first time I help someone :)
You tried.
[QUOTE=Disseminate;19468412]Your lua is fairly weird. for time = 1, length do will just print it length times all at once. player.Freeze takes a boolean as an argument. [editline]02:14PM[/editline] This won't work either. The following will: [lua]function FreezePly( ply ) ply:Freeze( true ) timer.Simple( 5, player.Freeze, false ) end concommand.Add( "ply_freeze", FreezePly )[/lua][/QUOTE] Nope, that won't work, too. However, this will: [lua]function FreezePly( ply ) ply:Freeze( true ) timer.Simple( 5, ply.Freeze, ply, false ) end concommand.Add( "ply_freeze", FreezePly )[/lua]
[QUOTE=Disseminate;19469343]You tried.[/QUOTE] Thats what i like to hear from people... You dont come here and do your good coder... Anyway I rated you polite
Sorry, you need to Log In to post a reply to this thread.