• Having a client find its own user id with Player.UserID
    14 replies, posted
How do I do this, have the player find itself...
if LocalPlayer():UserID() == useridgoeshere then?
OK got it
[QUOTE=(AMS-$)ILOVEPIE;18318729]How do I do this, have the player find itself...[/QUOTE] You want the client to find his own player object? No need to go farther then this : LocalPlayer()
Thanks! [editline]07:40PM[/editline] Ok... How do I make a script listen for something the server sends via echo?
[B]Server to Client[/B] [url=http://wiki.garrysmod.com/?search=User Messages&go=Go][I]User Messages[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] [url=http://wiki.garrysmod.com/?search=Usermessage.Hook&go=Go][I]Usermessage.Hook[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] [url=http://wiki.garrysmod.com/?search=Umsg.Start&go=Go][I]Umsg.Start[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] [B]Client to Server[/B] [url=http://wiki.garrysmod.com/?search=Concommand.Add&go=Go][I]Concommand.Add[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] [url=http://wiki.garrysmod.com/?search=G.RunConsoleCommand&go=Go][I]G.RunConsoleCommand[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] :science:
I was not looking for that i was looking for how to make it listen for Player:ChatPrint [editline]08:01PM[/editline] Yes he is polite
[QUOTE=(AMS-$)ILOVEPIE;18319613]I was not looking for that i was looking for how to make it listen for Player:ChatPrint.[/QUOTE] Well I'd really recommend against using that to send information to the player. If you want to grab chat information sent by the server then you should just user usermessages instead. If what you want to do is catch other player's chat then what you want is the OnPlayerChat hook. [B]edit:[/B] Maybe you can use the ChatText hook to catch server chatprints, but you really should be using usermessages for that. [url=http://wiki.garrysmod.com/?search=Gamemode.OnPlayerChat&go=Go][I]Gamemode.OnPlayerChat[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] [url=http://wiki.garrysmod.com/?search=Gamemode.ChatText&go=Go][I]Gamemode.ChatText[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] [url=http://wiki.garrysmod.com/?search=hook.Add&go=Go][I]hook.Add[/I] ([B]Wiki link [img]http://wiki.garrysmod.com/favicon.ico[/img][/b])[/url] :engleft:
or PrintMessage if the other doesent work
[QUOTE=(AMS-$)ILOVEPIE;18319854]or PrintMessage if the other doesent work[/QUOTE] Maybe you could explain what you're trying to do. :smile:
Ok I am making a lua script that allows me to do routene assmod actions with out spending so mutch time going through menus
Oh, with chat commands?:buddy: I tought you were doing something completely clientside! And if that's what you're doing you should reconsider it. You really should be doing all of those checks serverside using [url=http://wiki.garrysmod.com/?search=Gamemode.PlayerSay &go=Go][I]Gamemode.PlayerSay [/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url]
[QUOTE=Crazy Quebec;18320323]Oh, with chat commands?:buddy: I tought you were doing something completely clientside! And if that's what you're doing you should reconsider it. You really should be doing all of those checks serverside using [url=http://wiki.garrysmod.com/?search=Gamemode.PlayerSay &go=Go][I]Gamemode.PlayerSay [/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/QUOTE] I am doing it completely client side... I want it to work on all assmod servers I have admin on.(without changing server files)
At this rate I'll run out of wiki pages. The simplest way would be clientside console commands. If you want it done with the chat box entirely then it depends on whether or not you want that text sent to the server if it's a valid command. If you don't mind then just hook to Gamemode.OnPlayerChat to look for commands in what you typed, if you don't want commands sent to the server for everyone to see then my guess is you would have to use a custom chatbox (doesn't need a custom skin, just a custom handling) to parse your input before deciding if your player should actually "say" it or not, and for that I wish you good luck. There might be other ways but it's not exactly something I've done before. :smile: [B]Custom Chatbox Hooks[/B] [url=http://wiki.garrysmod.com/?search=Gamemode.StartChat&go=Go][I]Gamemode.StartChat[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=http://wiki.garrysmod.com/?search=Gamemode.ChatTextChanged&go=Go][I]Gamemode.ChatTextChanged[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] [url=http://wiki.garrysmod.com/?search=Gamemode.FinishChat&go=Go][I]Gamemode.FinishChat[/I] [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] :eng99:
srry
Sorry, you need to Log In to post a reply to this thread.