ULX

Author Topic: How can i make it say " *this person* has joined the server"  (Read 4750 times)

0 Members and 1 Guest are viewing this topic.

Offline datgregofag

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
How can i make it say " *this person* has joined the server"
« on: January 21, 2013, 07:25:35 AM »
Whenever i play on my server and i use ulx, it doesn't say anything in chat when someone joins my server. In evolve it says the persons name and when they last joined, is there any possible way to do that in ulx and if there is can someone help me do that. Thank you.

P.S Evolve is gay. ULX FOR DA WIN!!!

Offline datgregofag

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
Re: How can i make it say " *this person* has joined the server"
« Reply #1 on: January 21, 2013, 09:43:42 AM »
also i think to make it say in chat you have to modify this

local function playerConnect( name, address, steamid )
   if logEvents:GetBool() then
      ulx.logString( string.format( "Client \"%s\" connected (%s).", name, address ) )
   end
end
hook.Add( "PlayerConnect", "ULXLogConnect", playerConnect, -20 )

local function playerInitialSpawn( ply )
   local txt = string.format( "Client \"%s\" spawned in server (%s)<%s>.", ply:Nick(), not ply:IsBot() and ply:IPAddress() or "BOT", ply:SteamID() )
   if logEvents:GetBool() then
      ulx.logString( txt )
   end

   if logJoinLeaveEcho:GetBool() then
      echoToAdmins( txt )
   end
end
hook.Add( "PlayerInitialSpawn", "ULXLogInitialSpawn", playerInitialSpawn, -19 )

local function playerDisconnect( ply )
   local txt = string.format( "Dropped \"%s\" from server<%s>", ply:Nick(), ply:SteamID() )
   if logEvents:GetBool() then
      ulx.logString( txt )
   end

   if logJoinLeaveEcho:GetBool() then
      echoToAdmins( txt )
   end
end



can you please modify this or whatever you need to modify, im lua noooooob, also i got this from \garrysmod\addons\ulx\lua\ulx\logs.lua

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: How can i make it say " *this person* has joined the server"
« Reply #2 on: January 21, 2013, 01:18:56 PM »
This is what I use, put it in garrysmod/lua/autorun/server/WhateverNameYouWant.lua
Code: [Select]
--Enter and Exit server
function FirstSpawn( ply )
    PrintMessage( HUD_PRINTTALK, ply:Nick().. "("..ply:SteamID()..") entered the game.")
end
 
hook.Add( "PlayerInitialSpawn", "playerInitialSpawn", FirstSpawn )
 
function PlayerDisconnect( ply )
    PrintMessage( HUD_PRINTTALK, ply:Nick().. "("..ply:SteamID()..") has disconnected." )
end
 
hook.Add( "PlayerDisconnected", "playerDisconnected", PlayerDisconnect )

This also shows steam id. Handy for banning people who do bad stuff then leave.
My TTT server. Join the fun!

Offline datgregofag

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
Re: How can i make it say " *this person* has joined the server"
« Reply #3 on: January 21, 2013, 02:13:40 PM »
Thank you so much, i appreciate your kindness and generosity.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: How can i make it say " *this person* has joined the server"
« Reply #4 on: January 21, 2013, 03:44:51 PM »
Though the steamid would indeed be an addition...does Gmod not already show people connecting in the chat text???
Did GM13 change that?
I remember back when I played regularly, changing maps, tons of '<X> joined>' would pop up after the level change.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: How can i make it say " *this person* has joined the server"
« Reply #5 on: January 21, 2013, 06:21:13 PM »
I believe it was a ULX function, that no longer works? There's a place in xgui to turn it off and on, does nothing.
No prob datgregofag
My TTT server. Join the fun!

Offline TweaK

  • Jr. Member
  • **
  • Posts: 80
  • Karma: 14
    • Garry's Mod Engineers
Re: How can i make it say " *this person* has joined the server"
« Reply #6 on: January 22, 2013, 12:28:51 AM »
Figured I'd toss mine on here too.
Code: [Select]
local function onConnect( name, addr )
ULib.tsayColor( nil, false, Color(128, 255, 128), "Player " .. name .. " connected" )
end
hook.Add( "PlayerConnect", "doSayOnConnect", onConnect )

local function onInitialSpawn( ply )
for k, v in pairs( player.GetAll() ) do
if not ( v == ply ) then
ULib.tsay( v, "Player " .. ply:Nick() .. " has entered the game" )
end
end
end
hook.Add( "PlayerInitialSpawn", "doSayOnSpawn", onInitialSpawn )

local function onPlayerDisconnect( ply )
ULib.tsayColor( nil, false, Color(128, 255, 128), "Player " .. ply:Nick() .. " dropped from the game" )
end
hook.Add( "PlayerDisconnected", "doSayOnDisconnect", onPlayerDisconnect )


Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: How can i make it say " *this person* has joined the server"
« Reply #7 on: January 22, 2013, 08:55:35 AM »
It almost feels like this should be built into ULX (Didn't ULX have it already?) , maybe even some thing where you could make your own custom string.

Example...

%user% has joined from %country%

and you can also change it to

Welcome, %user% they are from %country%

or even

A %user% has connected!

Then throw in some convars like...

ulx_join_enabled 0/1 (To enable/disable showing when some one joined.)

ulx_join_showadmin 0/1/2 (If set to 0 admin names will be shown when they join, if set to 1 the join echo will be hidden when an admin joins, if set to 2 a fake name is shown instead of the admins name.)

I think that would be a good addition to ULX, don't you? Also if no one is going to make this I will :)
« Last Edit: January 22, 2013, 08:57:50 AM by HeLLFox_15 »
I cry every time I see that I am not a respected member of this community.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: How can i make it say " *this person* has joined the server"
« Reply #8 on: January 22, 2013, 12:48:51 PM »
Oo I like the idea of adding the country, Fox!
My TTT server. Join the fun!

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: How can i make it say " *this person* has joined the server"
« Reply #9 on: January 22, 2013, 02:39:35 PM »
UTime has the functionality you're looking for. :)
Experiencing God's grace one day at a time.