• Player.GetAll do
    13 replies, posted
[lua] if ( !ply:IsTeam == 6 ) then for k,v in pairs(player.GetAll()) do umsg.Start('menuhere', ply) umsg.End() v:PrintChat( 'Read the Derma Menu or Else!!', false ) v:PrintChat( 'Failure to note the OOC Content is against the rules', false ) end end end [/lua] My question is for the below what would I do. I Want to force the umsg on the client. [lua] umsg.Start('menuhere', ply) // What would I do here and below?? umsg.End() [/lua] Do I leave it or put a [lua]v:[/lua]?
If you want to send a usermessage to everyone in the server then don't give a second argument to umsg.Start().
I thought you had to do [lua]rp = RecipientFilter() rp:AddAllPlayers() umsg.Start("name", rp) umsg.String("lol") umsg.End()[/lua]
[lua]umsg.Start('menuhere', v ) umsg.End() [/lua] ????
Yeah, try replacing the ply with the v
[QUOTE=yakahughes;17059404]I thought you had to do [lua]rp = RecipientFilter() rp:AddAllPlayers() umsg.Start("name", rp) umsg.String("lol") umsg.End()[/lua][/QUOTE] No. This: [QUOTE=JetBoom;17059262]If you want to send a usermessage to everyone in the server then don't give a second argument to umsg.Start().[/QUOTE] [lua] if ( !ply:IsTeam == 6 ) then umsg.Start('menuhere') umsg.End() for k,v in ipairs(player.GetAll()) do v:PrintChat( 'Read the Derma Menu or Else!!', false ) v:PrintChat( 'Failure to note the OOC Content is against the rules', false ) end end [/lua]
Are empty user messages sent? I tried once, but I don't remember whether it worked or not.
[QUOTE=Overv;17062065]Are empty user messages sent? I tried once, but I don't remember whether it worked or not.[/QUOTE]Yes. Primary way of making the client open Derma menus.
Oh ok, I never saw JetBoom say that, so now I know :D
Don't bother creating usermessages just to open a menu, you can just use SendLua. inb4 idiot responds saying sendlua is evil.
[QUOTE=JetBoom;17074818]Don't bother creating usermessages just to open a menu, you can just use SendLua. inb4 idiot responds saying sendlua is evil.[/QUOTE]If you pool the usermessage's name, an empty umsg.Send takes up much less network bandwith than a SendLua (or indeed a BroadcastLua)
Yeah you saved those precious 20 bytes per hour.
[QUOTE=Lexic;17061887] [lua] if ( !ply:IsTeam == 6 ) then umsg.Start('menuhere') umsg.End() for k,v in ipairs(player.GetAll()) do v:PrintChat( 'Read the Derma Menu or Else!!', false ) v:PrintChat( 'Failure to note the OOC Content is against the rules', false ) end end [/lua][/QUOTE] Unrelated question: Is there any difference in using [b]ipairs[/b] instead of [b]pairs[/b] at for-statements?
[QUOTE=Dlaor;17124345]Unrelated question: Is there any difference in using [b]ipairs[/b] instead of [b]pairs[/b] at for-statements?[/QUOTE] 'ipairs' is faster than 'pairs', but it only iterates over number keys.
Sorry, you need to Log In to post a reply to this thread.