SA-MP Forums Archive
[Include] Clan System [Sqlite Save/Load] - 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)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Clan System [Sqlite Save/Load] (/showthread.php?tid=544787)



Clan System [Sqlite Save/Load] - VinPure - 04.11.2014

Intro:
-After obtaining the consent of fiki574 I've re-release include Clan and I rewrote it. The system I use Sqlite data to save / load the clan.
-Link:
*Mysql clan by fiki574*
__________________________________________________ ______________________________________________
*Question: Why you re-release it?
*answer: I rewrite the native/stock and public to sqlite database and Add more navite useful in this include.
ex: ChangeClanRankName fuction.
NATIVES:

Total more 30 custom natives that helps you to properly use this clan system! Here, I am going to show you all natives and examples of using them!

List of the natives:
pawn Код:
native CreateClan(playerid, clan_name[], clan_tag[], clan_pass[], clan_description[], clan_motd[],rank0[],rank1[],rank2[],rank3[],rank4[],rank5[],rank6[])

native PlayerAddPlayerToClan(playerid, addid);
native AddPlayerToClan(addid,clan_name[]);

native PlayerRemovePlayerFromClan(playerid, removeid);
native RemovePlayerFromClan(removeid,clan_name[]);

native LeaveClan(playerid);

native PlayerDisbandClan(playerid);
native DisbandClan(playerid);

native PlayerChangePlayerClanRank(playerid, giveid, rank);
native ChangePlayerClanRank(clan_name[],playerid,rank);

native PlayerChangeClanRankName(playerid,rank,newname[]);
native ChangeClanRankName(clan_name[],rank,newname[]);

native PlayerChangeClanMOTD(playerid, new_motd[]);
native ChangeClanMOTD(clan_name[],new_motd[]);

native PlayerChangeClanDescription(playerid, new_description[]);
native ChangeClanDescription(clan_name[], new_description[]);

native PlayerChangeClanPassword(playerid, new_pass[]);
native ChangeClanPassword(clan_name[], new_pass[]);

native PlayerChangeClanTag(playerid, new_tag[]);
native ChangeClanTag(clan_name[], new_tag[]);

native IsPlayerAnyClanMember(playerid);
native IsPlayerClanMember(playerid, clan_name[]);
native GetPlayerClan(playerid);
native GetPlayerClanRank(playerid);
native GetPlayerClanRankName(playerid);
native GetClanMOTD(clan[]);
native GetClanDescription(clan[]);
native GetClanMembers(clan[]);
native GetClanTag(clan[]);
native GetClanPassword(clan[]);
native UseClanTags(bool:use = true);
native UseClanPasswords(bool:use = true);
native SendMessageToClanMembers(playerid, color, msg[]);
native SendMessageToClanMembersEx(clan[], color, msg[]);
Now, here is explanation and example usage of each native!
Creating a clan:This version no have weapon
pawn Код:
CreateClan(playerid, clan_name[], clan_tag[], clan_pass[], clan_description[], clan_motd[],rank0[],rank1[],rank2[],rank3[],rank4[],rank5[],rank6[])
//playerid - for calling function and sending a message
//clan_name[] - name of your clan
//clan_tag[] - tag that will be saved to your clan's stats
//clan_pass[] - password for your clan
//clan_description[] - describe your clan in few words
//clan_motd[] - clan's message of the day
//rank0[] - Name of rank 0
//rank1[] - Name of rank 1
//rank2[] - Name of rank 2
//rank3[] - Name of rank 3
//rank4[] - Name of rank 4
//rank5[] - Name of rank 5
//rank6[] - Name of rank 6
//.max is 7 rank 0-6
Example:
pawn Код:
CMD:createclan(playerid,params[])
{
     new cname[30], ctag[30], cpass[30];
     if(sscanf(params, "s[30]s[30]s[30]", cname, ctag, cpass)) return SendClientMessage(playerid,-1,"USAGE: /cclan <clan-name> <clan-tag> <clan-pass>");
     CreateClan(playerid, cname, ctag, cpass, "", "","Newbie","Member","ClanMember","Master","Legend","Subleader","Leader");
     return 1;
}
Full Example In:https://github.com/VinPure/PAWNO/blo...example%20clan
CALLBACKS:
This system has a several custom callbacks that are called on performing specific natives!

Callbacks list:
pawn Код:
forward OnPlayerClanCreate(playerid, clan_name[]);

forward OnPlayerAddPlayerToClan(playerid, addid, clan_name[]);
forward OnPlayerAddToClan(addid,clan_name[]);

forward OnPlayerRemovePlayerFromClan(playerid, removeid, clan_name[]);
forward OnPlayerRemoveFromClan(removeid,clan_name[]);

forward OnPlayerLeaveClan(playerid, clan_name[]);

forward OnPlayerDisbandClan(playerid, clan_name[]);
forward OnDisbandClan(clan_name[]);

forward OnPlayerChangeClanMOTD(playerid, new_motd[]);
forward OnClanChangeMOTD(clan_name[], new_motd[]);

forward OnPlayerChangeClanDescription(playerid, new_description[]);
forward OnClanChangeDescription(clan_name[], new_description[]);

forward OnPlayerChangeClanPassword(playerid, new_pass[]);
forward OnClanChangePassword(clan_name[], new_pass[]);

forward OnPlayerChangeClanTag(playerid, new_tag[]);
forward OnClanChangeTag(clan_name[], new_tag[]);

forward OnPlayerChangePlayerRank(playerid, giveid, new_rank);
forward OnClanChangePlayerRank(clan_name[], giveid, new_rank);

forward OnPlayerChangeClanRankName(playerid,rank,newname[]);
forward OnClanChangeRankName(clan_name[],rank,newname[]);
Example:
pawn Код:
public OnPlayerClanCreate(playerid, clan_name[])
{
    new string[128];
    format(string,sizeof(string),"Clan %s has been created by %s",clan_name,GetName(playerid));
    SendClientMessageToAll(-1,string);
    print(string);
    return 1;
}
Full List Example:https://github.com/VinPure/PAWNO/blo...example%20clan
IMPORTANT NOTES:
- This system uses Sqlite to save/load it will create database with name clans.db
- This system uses OnFilterScriptInit in itself
- This system uses OnPlayerSpawn in itself
- This system uses OnPlayerText in itself
- This system uses OnDialogResponse in itself
- This system uses OnPlayerConnect in itself
- This system uses it's own messages/notifications so there is no need of using extra SendClientMessages
- To use clan chat, you have to type symbol "$" first!
- In this thread, I used ZCMD/sscanf only as example, but if you wanna copy/paste my examples in script, make sure you have ZCMD include and sscanf include + plugin (sscanf)
CREDITS:
fiki574_CRO - creating this system. owner this include
VinPure : rewrite/add some native and cover mysql to sqlite
Zeex - ZCMD include
****** - sscanf include + plugin
DOWNLOAD:
*Githud*
*Image:




Re: Clan System [Sqlite Save/Load] - Pottus - 04.11.2014

Good one this is the way to go for this kind of system!


Re: Clan System [Sqlite Save/Load] - VinPure - 04.11.2014

Thank man Pottus.


Re: Clan System [Sqlite Save/Load] - fiki574 - 04.11.2014

Awesome! I'm glad I had someone interested in rewriting this since I didn't do it myself.


Re: Clan System [Sqlite Save/Load] - VinPure - 04.11.2014

Thank you.


Re: Clan System [Sqlite Save/Load] - Alex Magaсa - 04.11.2014

Good job looks dope.


Re: Clan System [Sqlite Save/Load] - Ghazal - 04.11.2014

Awesome one.


Re: Clan System [Sqlite Save/Load] - VinPure - 05.11.2014

Thank all.


Re: Clan System [Sqlite Save/Load] - [AH]BlackAngel - 05.11.2014

WoW This is just what i need. Thanks man.


Re: Clan System [Sqlite Save/Load] - Glossy42O - 05.11.2014

Nice one :P

But why you got s-o-beit*?