Hello,
Recently, I have tried to learn Lua, and I am currently creating a cheat for gmod. I am trying to use GetFriendStatus in order to determine who's my friend, blocked, requested, or in no relationship with me at all.
Code:
surface.CreateFont("Casual",{ font = "TabLarge", size = 16, weight = 700, outline = true })
local function MESPCheck(v)
if v:Alive() == true and v:Health() ~= 0 and v:Health() > 0 and v ~= LocalPlayer() and LocalPlayer():Alive() then
return true
else
return false
end
end
--[Health & Name ESP]--
CreateClientConVar("esp", 1, true, false)
hook.Add("HUDPaint", "ESP", function()
for k,v in pairs( player.GetAll() ) do
if GetConVarNumber("esp") == 1 then
if MESPCheck(v) and v:Team() ~= TEAM_SPECTATOR and v:Team() ~= TEAM_UNASSIGNED then
local Pos = v:GetPos():ToScreen()
draw.DrawText( "Health: "..v:Health(), "Casual", Pos.x, Pos.y + 18, Color( 255, 255, 255, 255), 1 );
draw.DrawText( v:SteamID(), "Casual", Pos.x, Pos.y + 36, Color( 255, 255, 255, 255), 1 );
print( v:GetFriendStatus() )
if v:GetFriendStatus == "none" or v:GetFriendStatus == "requested" then
draw.DrawText( v:Name(), "Casual", Pos.x, Pos.y, Color( 254, 247, 117, 255 ), 1 );
end
end
end
end
end)
What I'm trying to do is print the relationship status of all the current players in the server, to then determine the color of my name esp. However, when I test this out, it says that on line 22,
Code:
if v:GetFriendStatus == "none" or v:GetFriendStatus == "requested" then
that the function arguments near '==':
Code:
[ERROR] lua/unnamed.lua:22: function arguments expected near '=='
1. unknown - lua/unnamed.lua:0
What's the reasoning behind this? What am I doing wrong? I know, I know, I am garbage at coding. If there's another, preferably easier way to execute what I am trying to do, please let me know as well.
Thanks.