• Clientside printmessage
    5 replies, posted
Problem using player:PrintMessage clientside. [lua]function WMOrderMsg (omsg) surface.PlaySound("/weapons/smg1/switch_burst.wav"); local mode = omsg:ReadLong(); if mode == 0 then LocalPlayer():PrintMessage(HUD_PRINTCENTER, "Warmelons moving to waypoint"); elseif mode == 1 then LocalPlayer():PrintMessage(HUD_PRINTCENTER, "Warmelons following target"); elseif mode == 2 then LocalPlayer():PrintMessage(HUD_PRINTCENTER, "Warmelons attacking target"); else LocalPlayer():PrintMessage(HUD_PRINTCENTER, "Invalid order mode ID received"); end end usermessage.Hook("WMOrderMsg", WMOrderMsg); [/lua] Sound plays fine, but no text comes up, and no error is shown. What's going on? It worked fine when I called it serverside.
Scrap that. Wiki says print message is a server side function [url]http://wiki.garrysmod.com/?title=G.PrintMessage[/url]
I thought this was client side.. Hmm. Just make your own message system, the center chat thing is ugly anyway.
[QUOTE=blackops7799;17234716]I thought this was client side.. Hmm. Just make your own message system, the center chat thing is ugly anyway.[/QUOTE] Apparently not. The wiki says shared, but: [code]lua_run_cl LocalPlayer():PrintMessage( HUD_PRINTCENTER, "Testing")[/code] Doesn't work.
Odd.. Well the function is definitely client side too.. because this works. [code] lua_run_cl LocalPlayer():PrintMessage( HUD_PRINTTALK, "Testing") [/code] I guess HUD_PRINTCENTER is broken on client?
Sharpe, your link is to the global PrintMessage, not the player function. Unless I've been reading the wiki wrong, player:PrintMessage is shared.
Sorry, you need to Log In to post a reply to this thread.