Author Topic: Leave Message on Server that Displays to a joining Steam ID?  (Read 6570 times)

0 Members and 1 Guest are viewing this topic.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Leave Message on Server that Displays to a joining Steam ID?
« Reply #15 on: January 18, 2014, 03:25:36 PM »
Well. Let's just say it like this. This code:
Code: [Select]
function ulx.setmessage( calling_ply, steamid, msg )
steamid = string.upper( steamid ) -- Steam ID needs to be uppercase.
if not ULib.isValidSteamID( steamid ) then
ULib.tsayError( calling_ply, "Invalid steamid.", true )
return false
else
util.SetPData( steamid, "ULXSetMessage", msg )
ulx.fancyLogAdmin( calling_ply, true, "#A set a message to print for #s when the player joins.", steamid )
end
end
local setmessage = ulx.command( "Utility", "ulx setmessage", ulx.setmessage, "!setmessage" )
setmessage:addParam{ type=ULib.cmds.StringArg, hint="Player Steam ID" }
setmessage:addParam{ type=ULib.cmds.StringArg, hint="Message to print for the player" }
setmessage:defaultAccess( ULib.ACCESS_ADMIN )
setmessage:help( "Set's a message to a certain Steam ID that will print when they join." )

function SetMessagePrint( ply )
if ply:GetPData( "ULXSetMessage", 0 ) ~= 0 then -- If "ULXSetMessage" is not set to "0" (0 is default).
ply:ChatPrint( ply:GetPData( "ULXSetMessage" ) )
ply:RemovePData( "ULXSetMessage" ) -- Makes sure to remove the message after it's printed. Will only print once.
end
end
hook.Add( "PlayerInitialSpawn", "SetMessagePrint", SetMessagePrint )
Is what I use, nothing else. And it gives me an error. I have absolutely no idea what could be wrong, honestly.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.