Hi there,
What function would I use to make a player suicide when he leaves the game?
Thanks.
The player disconnects and disappears, unless you want to create a ragdoll where they were, there is no point.
Pretty pointless 0_o?
But heres something i wiped up
[code]
function PlayerDisconnect( ply )
ply:Kill()
end
hook.Add( "PlayerDisconnected", "PlayerDisconnect", PlayerDisconnect )
[/code]
When a player disconnects the player's entity goes away like magic.
I need this because if a selected player leaves the game it breaks the HUD however, it does not break if they suicide/die then leave.
Use an IsValid check in the HUD??
[lua]
if (IsValid LocalPlayer()) then
return -- your shit goes here
end
[/lua]
[QUOTE=RattSplat;40437788][lua]
if (IsValid LocalPlayer()) then
return -- your shit goes here
end
[/lua][/QUOTE]
That is not how IsValid works...
[lua]
if (IsValid(LocalPlayer())) then
-- your shit goes here
end
[/lua]
or
[lua]
if (LocalPlayer():IsValid()) then
-- your shit goes here
end
[/lua]
You don't need to return anything either. It's not a function
[url]http://wiki.garrysmod.com/page/Global/IsValid[/url]
[url]http://wiki.garrysmod.com/page/Entity/IsValid[/url]
Sorry, you need to Log In to post a reply to this thread.