Fix console call error (#137)

* Fix console call error

* Add empty friend tbl message

* Check caller in receiver

* Update lua/ulx/modules/sh/cfc_checkfriends.lua

Co-authored-by: legokidlogan <26103433+legokidlogan@users.noreply.github.com>

---------

Co-authored-by: legokidlogan <26103433+legokidlogan@users.noreply.github.com>
This commit is contained in:
Redox 2023-11-24 23:08:19 +01:00 committed by GitHub
parent 1b308c5f41
commit 48f59eecc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,18 @@ end
local awaitingResponse = {}
local function sendResponse( ply, friendTable, caller )
if not IsValid( caller ) then -- console
print( "\n=======================" )
print( ply:Name() .. "'s friends:" )
print( "-----------------------" )
for target, status in pairs( friendTable ) do
print( target:Name() .. " : " .. status )
end
print( "=======================" )
return
end
caller:PrintMessage( 2, "\n=======================" )
caller:PrintMessage( 2, ply:Name() .. "'s friends:" )
caller:PrintMessage( 2, "-----------------------" )
@ -26,6 +38,11 @@ net.Receive( "CFC_ULX_CheckFriendsReceive", function( _, ply )
local caller = awaitingResponse[ply]
if table.IsEmpty( friendTable ) then
if IsValid( caller ) then
caller:PrintMessage( 2, ply:Name() .. " does currently not have any friends on the server." )
else
print( ply:Name() .. " does currently not have any friends on the server." )
end
return
end