SA-MP Forums Archive
[FilterScript] [MySQL] Friend System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] [MySQL] Friend System (/showthread.php?tid=567988)



[MySQL] Friend System - Jingles - 18.03.2015

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


Re: [MySQL] Friend System - Mya - 18.03.2015

wow, that's cool, thanks for sharing REP++ for you


Re: [MySQL] Friend System - kampuman - 19.03.2015

This is really useful! Good job for originality!


Re: [MySQL] Friend System - hamzajaved780 - 19.03.2015

Very nice bro...... +1


Re: [MySQL] Friend System - Younes44 - 19.03.2015

Awesome D:
Keep it up xD


Re: [MySQL] Friend System - AchievementMaster360 - 21.03.2015

Nice!


Re: [MySQL] Friend System - TonyCan - 22.03.2015

Nice


Respuesta: [MySQL] Friend System - Johangelo1 - 16.03.2017

Nice. You do not have it in SQLite?


Re: Respuesta: [MySQL] Friend System - SyS - 16.03.2017

Quote:
Originally Posted by Johangelo1
View Post
Nice. You do not have it in SQLite?
you can easily convert it to sqlite its just matter of changing few lines.


Re: [MySQL] Friend System - Rodzknot - 16.03.2017

Wow! Nice work!
Is this applicable to any modes?


Respuesta: [MySQL] Friend System - Kaponi - 28.03.2017

Nice! +rep


Re: [MySQL] Friend System - Johangelo1 - 18.01.2018

pass it in sqlite?