• Getting player friends?
    1 replies, posted
I want to make a !friends command for evolve which will list all the friends a player has on the server. The problem is I don't know how to get the players friends. I've seen on the wiki player:GetFriendStatus() the only problem is that it is a CLIENT function and there are no arguments so I have no idea who its getting the friend status of. Here's where I have gotten to: [CODE]local AllPlayersOnServer = player:GetAll() local Friends = { } for i = 1, #AllPlayersOnServer do if CLIENT then if players[1]:GetFriendStatus()[/CODE] then I realised there are no arguments for GetFreindStatus so I'm wondering who it's checking the friend status for? Any help is appreciated.
[url=http://wiki.garrysmod.com/page/Player/GetFriendStatus]I thought the wiki article was pretty clear.[/url] It returns if the status of the player you call on it to the local client, so your friends would show up as "friend" and so on for each state. So, to get all the friends it'd be something like: [code]local friends = { } for k, v in ipairs( player.GetAll( ) ) do if v:FriendStatus( ) == "friend" then table.insert( friends, v ) end end[/code] You'll need to network it yourself if you want the server to do something with your friends, though.
Sorry, you need to Log In to post a reply to this thread.