SHOW:
|
|
- or go back to the newest paste.
| 1 | - | function PrintSteamID() |
| 1 | + | function PrintSteamID(ply) |
| 2 | - | local trace = ply:GetEyeTrace() |
| 2 | + | if not IsValid(ply) then return end |
| 3 | local trace = ply:GetEyeTrace() | |
| 4 | - | if( trace.Entity:IsPlayer()) then |
| 4 | + | |
| 5 | - | chat.AddText( Color( 0, 255, 0 ), "The SteamID of this player is ", Color ( 255, 0, 0 ), trace.Entity:SteamID(), Color( 0, 255, 0 ), " and the name is ", Color ( 255, 0, 0 ), trace.Entity:Name()) |
| 5 | + | if IsValid(trace.Entity) and trace.Entity:IsPlayer() then |
| 6 | - | else |
| 6 | + | chat.AddText( Color( 0, 255, 0 ), "The SteamID of this player is ", Color ( 255, 0, 0 ), trace.Entity:SteamID(), Color( 0, 255, 0 ), " and the name is ", Color ( 255, 0, 0 ), trace.Entity:Name()) |
| 7 | - | chat.AddText( Color( 0, 255, 0 ), "You are not looking at a player!") |
| 7 | + | else |
| 8 | - | end |
| 8 | + | chat.AddText( Color( 0, 255, 0 ), "You are not looking at a player!") |
| 9 | end | |
| 10 | end | |
| 11 | - | concommand.Add( "traceinfo", function() |
| 11 | + | |
| 12 | - | if game.SinglePlayer() then |
| 12 | + | concommand.Add( "traceinfo", function(ply) |
| 13 | - | chat.AddText( Color( 0, 255, 0 ), "You are in singleplayer join multiplayer to use this!") |
| 13 | + | if game.SinglePlayer() then |
| 14 | - | else |
| 14 | + | chat.AddText( Color( 0, 255, 0 ), "You are in singleplayer join multiplayer to use this!") |
| 15 | - | PrintSteamID() |
| 15 | + | else |
| 16 | - | print( "Got the information of the player you are looking at!" ) |
| 16 | + | PrintSteamID(ply) |
| 17 | - | end |
| 17 | + | end |
| 18 | - | end ) |
| 18 | + | end) |