[FilterScript] [MySQL] Friend System
#1

Hi there!

I had some free time and decided to script a friend list feature (using MySQL to store/extract data).
Once someone enters a name (or ID if online), it will be compared with the `Username` column in the accounts database.

The DBID will be extracted and added to a new database, along with the player's DBID.

A .zip package can be found in the attachments. And here is a mirror:
Download Here

Make sure to change all MySQL name values to your own database's.

Default is:
Player accounts DB: `accounts`
Friend DB: `friendsdb`

Account ID in accounts DB: `id`
Username in accounts DB: `Username`


Commands:

/addfriend [NAME / ID] - Adds a friend to your friendlist.
/friends - Displays a list of all the players you are befriended with.


How it works:
5 = "Farva"
5014 = "Benny_McCabe"
12340 = "Eddie_Murphy"
55100 = "Sam_Jingles"

"Sam_Jingles" (55100) enters the command:
"/addfriend eddie_murphy" (or when "Eddie_Murphy" is online, he can simply enter "/addfriend [ID]" or "/addfriend Eddie)

"Eddie_Murphy"'s DBID will be copied into a new entry in the `friendsdb` database, linking it to "Sam_Jingles".
After a while, Sam_Jingles has made some friends. The database will look like this:



Once "Sam_Jingles" enters the command: "/friends", he will get a friendlist that links the `FriendID` in the `friendsdb` database back to the usernames in the original accounts database.
"Sam_Jingles" is befriended with: "Farva", "Benny_McCabe", "Eddie_Murphy".
"Farva" is befriended with: "Benny_McCabe"
"Eddie_Murphy" is befriended with: "Sam_Jingles", "Farva".

And after a year or so, you'll be able to export the database and generate a map and see a sociographic representation of the social groups/relationships between NGG players :P.



Enjoy!

Jingles
Reply


Messages In This Thread
[MySQL] Friend System - by Jingles - 18.03.2015, 12:54
Re: [MySQL] Friend System - by Mya - 18.03.2015, 13:09
Re: [MySQL] Friend System - by kampuman - 19.03.2015, 14:15
Re: [MySQL] Friend System - by hamzajaved780 - 19.03.2015, 15:17
Re: [MySQL] Friend System - by Younes44 - 19.03.2015, 16:19
Re: [MySQL] Friend System - by AchievementMaster360 - 21.03.2015, 01:58
Re: [MySQL] Friend System - by TonyCan - 22.03.2015, 08:06
Respuesta: [MySQL] Friend System - by Johangelo1 - 16.03.2017, 01:18
Re: Respuesta: [MySQL] Friend System - by SyS - 16.03.2017, 01:25
Re: [MySQL] Friend System - by Rodzknot - 16.03.2017, 11:02
Respuesta: [MySQL] Friend System - by Kaponi - 28.03.2017, 20:50
Re: [MySQL] Friend System - by Johangelo1 - 18.01.2018, 01:47

Forum Jump:


Users browsing this thread: 1 Guest(s)