Ulysses

Ulysses Stuff => General Chat & Help and Support => Topic started by: datgregofag on January 21, 2013, 07:25:35 AM

Title: How can i make it say " *this person* has joined the server"
Post by: datgregofag 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!!!
Title: Re: How can i make it say " *this person* has joined the server"
Post by: datgregofag 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
Title: Re: How can i make it say " *this person* has joined the server"
Post by: krooks 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.
Title: Re: How can i make it say " *this person* has joined the server"
Post by: datgregofag on January 21, 2013, 02:13:40 PM
Thank you so much, i appreciate your kindness and generosity.
Title: Re: How can i make it say " *this person* has joined the server"
Post by: JamminR 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.
Title: Re: How can i make it say " *this person* has joined the server"
Post by: krooks 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
Title: Re: How can i make it say " *this person* has joined the server"
Post by: TweaK 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 )
Title: Re: How can i make it say " *this person* has joined the server"
Post by: LuaTenshi 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 :)
Title: Re: How can i make it say " *this person* has joined the server"
Post by: krooks on January 22, 2013, 12:48:51 PM
Oo I like the idea of adding the country, Fox!
Title: Re: How can i make it say " *this person* has joined the server"
Post by: Megiddo on January 22, 2013, 02:39:35 PM
UTime has the functionality you're looking for. :)