Ulysses Stuff > Releases

Player Connect/Disconnect Message [1.11v]

<< < (11/37) > >>

PinkieHoofBump:
Is it possible to add the country when a player joins the server? like:  "PinkieHoofBump has entered the game from The Netherlands."?
That would be great!

Decicus:

--- Quote from: PinkieHoofBump on November 15, 2013, 06:58:26 AM ---Is it possible to add the country when a player joins the server? like:  "PinkieHoofBump has entered the game from The Netherlands."?
That would be great!

--- End quote ---
That would require you to fetch the IP using something like Player.IPAddress then check that IP with some sort of GeoLocation database. I'm not sure how you would do that though.

Pizhik:
Can you modify the code so that it was written in a chat message when connected player, not first spawned?

Bite That Apple:

--- Quote from: Pizhik on November 17, 2013, 06:00:45 AM ---Can you modify the code so that it was written in a chat message when connected player, not first spawned?

--- End quote ---

This has been brought up before. Though colors do not work, which is a major reason why I made this addon.

You can do this yourself though by changing:
sv_player.lua

--- Code: ---// server side apple
AddCSLuaFile( "cl_player.lua"  )

//Spawn
function FirstSpawn( ply )
spawn1 = ply:Nick()
umsg.Start( "player_spawn")
umsg.String(spawn1)
umsg.End()
Msg("Player " .. spawn1 .. " has joined the server.\n")
end
 
hook.Add( "PlayerConnected", "playerInitialSpawn", FirstSpawn )

 
//Disconnect
function PlayerDisconnect( ply )
colour3 = ply:Team()
spawn3 = ply:Nick()
umsg.Start( "player_disconnect")
umsg.String(spawn3)
umsg.Short(colour3)
umsg.End()
Msg("Player " .. spawn3 .. " has left the server.\n")
end
 
hook.Add( "PlayerDisconnected", "playerDisconnected", PlayerDisconnect )
--- End code ---


cl_player.lua

--- Code: ---// client side apple

// Spawn
function player_spawn( data )
local name1 = data:ReadString()
chat.AddText( Color( 255, 0, 255 ), "[Server] ", name1, Color( 255, 255, 255 ), " has joined in the server." )
surface.PlaySound( "garrysmod/save_load1.wav" )
end
usermessage.Hook("player_spawn", player_spawn)

// Disconnect
function player_disconnect( data )
local name3 = data:ReadString()
local nickteamcolour3 = team.GetColor(data:ReadShort())
chat.AddText( Color( 255, 0, 255 ), "[Server] ", nickteamcolour3, name3, Color( 255, 255, 255 ), " has left the server." )
surface.PlaySound( "garrysmod/save_load2.wav" )
end
usermessage.Hook("player_disconnect", player_disconnect)
--- End code ---


That should work, though I didn't test it.

Bite That Apple:
REMINDER:
I have updated this recently, and I forgot to tell you guys about it. So when you all have time for those who have this addon, check it out and download this new version, k-thanks-bye!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version