Ulysses Stuff > Releases

Player Connect/Disconnect Message [1.11v]

<< < (10/37) > >>

cynel:

--- Quote from: chaos13125 on October 21, 2013, 07:37:01 PM ---
I'm sorry, I'm not able to help you out here. I've become busy with a IRL situation, and some major other issues. Though, you're in a great community, so someone may be able to help you out here.

--- End quote ---

Ah, no problem! I'll just keep trying  :)

npd1124:
for some reason the disconnect message works but it doesnt display the message when someone join the server that is the most important part of it


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

// Spawn
function player_spawn( data )
local name1 = data:ReadString()
local nickteamcolour1 = team.GetColor(data:ReadShort())
chat.AddText( Color( 5, 29, 168 ), "[FuZionGaming] ", nickteamcolour1, 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( 5, 29, 168 ), "[FuZionGaming] ", 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 ---

Bite That Apple:

--- Quote from: npd1124 on November 11, 2013, 06:33:19 AM ---for some reason the disconnect message works but it doesnt display the message when someone join the server that is the most important part of it


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

// Spawn
function player_spawn( data )
local name1 = data:ReadString()
local nickteamcolour1 = team.GetColor(data:ReadShort())
chat.AddText( Color( 5, 29, 168 ), "[FuZionGaming] ", nickteamcolour1, 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( 5, 29, 168 ), "[FuZionGaming] ", 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 ---

--- End quote ---

Can you please post the server side script too?

npd1124:

--- Quote from: chaos13125 on November 11, 2013, 07:55:10 AM ---Can you please post the server side script too?

--- End quote ---

here is the server code


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

//Spawn
function FirstSpawn( ply )
timer.Create( "server_spawn_timer_wait", 3, 1, function()
colour1 = ply:Team()
spawn1 = ply:Nick()
umsg.Start( "player_spawn")
umsg.String(spawn1)
umsg.Short(colour1)
umsg.End()
Msg("Player " .. spawn1 .. " has joined the server.\n")
end)
end
 
hook.Add( "PlayerInitialSpawn", "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 ---

Bite That Apple:

--- Quote from: npd1124 on November 11, 2013, 08:13:26 AM ---here is the server code


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

//Spawn
function FirstSpawn( ply )
timer.Create( "server_spawn_timer_wait", 3, 1, function()
colour1 = ply:Team()
spawn1 = ply:Nick()
umsg.Start( "player_spawn")
umsg.String(spawn1)
umsg.Short(colour1)
umsg.End()
Msg("Player " .. spawn1 .. " has joined the server.\n")
end)
end
 
hook.Add( "PlayerInitialSpawn", "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 ---

--- End quote ---

Not sure mate. I'd try the original version, and see if it works for you, and debug from there.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version