mysql_query(g_SQL, "CREATE TABLE IF NOT EXISTS Clans(`ID` int(5) NOT NULL auto_increment PRIMARY KEY, `Name` varchar(50) NOT NULL)");
native Shinja_CreateClan(name[], connectionHandle); native Shinja_DestroyClan(clanid, connectionHandle); native Shinja_IsClanExists(clanid, connectionHandle); native Shinja_IsClanNameExists(name[], connectionHandle); native Shinja_GetClanID(name[], connectionHandle); native Shinja_GetClanName(clanid, connectionHandle); native Shinja_GetPlayerClan(playerid, connectionHandle); native Shinja_SetPlayerClan(playerid, clanid, connectionHandle); native Shinja_IsPlayerInAnyClan(playerid, connectionHandle);
CMD:createclan(playerid, params[])
{
new cname[50], string[126];
if(sscanf(params, "s[50]", cname)) return SendClientMessage(playerid, -1, "{0008F7}USAGE: {FFFFFF}/CREATECLAN CLAN_NAME");
new lenght = strlen(cname);
if(lenght < 6) return SendClientMessage(playerid, -1, "{FF0000}Clan name must contain atleast 6 Characters");
if(IsClanNameExists(cname, g_SQL)) return SendClientMessage(playerid, -1, "{FF0000}This clan already exists");
CreateClan(cname, g_SQL);
SetPlayerClan(playerid, GetClanID(cname, g_SQL), g_SQL);
format(string, 126, "{00FF1E}You have succesfully created a clan ''{FF0000}%s''", cname);
SendClientMessage(playerid, -1, string);
new Float: PPos[3];
GetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]);
PlayerPlaySound(playerid, 1137, PPos[0], PPos[1], PPos[2]);
return 1;
}
CMD:closeclan(playerid, params[])
{
new string[126];
if(!IsPlayerInAnyClan(playerid, g_SQL)) return SendClientMessage(playerid, -1, "{FF0000}You are not owner of any clan");
DestroyClan(pClan[playerid], g_SQL);
SetPlayerClan(playerid, -1, g_SQL);
format(string, 126, "{00FF1E}You have succesfully destroyed your clan clan ''{FF0000}%s''");
SendClientMessage(playerid, -1, string);
new Float: PPos[3];
GetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]);
PlayerPlaySound(playerid, 1137, PPos[0], PPos[1], PPos[2]);
return 1;
}
CMD:c(playerid, params[])
{
new string[250], msg[150];
if(!IsPlayerInAnyClan(playerid, g_SQL)) return SendClientMessage(playerid, -1, "{FF0000}You are not in any clan");
if(sscanf(params, "s[150]", msg)) return SendClientMessage(playerid, -1, "{0008F7}USAGE: {FFFFFF}/C MESSAGE");
format(string, 200, "{000000}[{32DBAB}CLAN{000000}.{32DBAB}CHAT{000000}] {00B884}%s(%d){000000}: {9AF5DB}%s", GetName(playerid), playerid, msg);
SendToClan(playerid, -1, string);
return 1;
}
CMD:cinvite(playerid, params[])
{
new string[250],id;
if(!IsPlayerInAnyClan(playerid, g_SQL)) return SendClientMessage(playerid, -1, "{FF0000}You are not in any clan");
if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1, "{0008F7}USAGE: {FFFFFF}/CINVITE ID");
if(GetPlayerClan(id, g_SQL) != -1) return SendClientMessage(playerid, -1, "{FF0000}Player already in a clan");
format(string, 200, "{000000}[{32DBAB}CLAN{000000}.{32DBAB}INVITATION{000000}] {00B884}%s(%d) has invited %s(%d) to join the clan", GetName(playerid), playerid, GetName(id), id);
SendToClan(playerid, -1, string);
format(string, 200, "{000000}[{32DBAB}CLAN{000000}.{32DBAB}INVITATION{000000}] {00B884}%s(%d) has invited you to join his clan. /cjoin to accept", GetName(playerid), playerid);
SendClientMessage(id, -1, string);
InvitedClan[id] = GetPlayerClan(playerid, g_SQL);
clan[id] = SetTimerEx("CancelClan", 15000, false, "i", id);
return 1;
}
CMD:cjoin(playerid, params[])
{
new string[250];
if(InvitedClan[playerid] == -1) return SendClientMessage(playerid, -1, "{FF0000}You are not invited to join any clan!");
pClan[playerid] = InvitedClan[playerid];
new qufery[100];
format(qufery, sizeof(qufery), "UPDATE Users SET Clan = %d WHERE Name = '%s'", pClan[playerid], GetName(playerid));
mysql_query(g_SQL, qufery);
format(string, 200, "{000000}[{32DBAB}CLAN{000000}.{32DBAB}JOIN{000000}] {00B884}%s(%d) has joined the clan", GetName(playerid), playerid);
SendToClan(playerid, -1, string);
KillTimer(clan[playerid]);
return 1;
}
stock GetName(playerid) { new szName[MAX_PLAYER_NAME]; GetPlayerName(playerid, szName, sizeof(szName)); return szName; } |
#include <a_samp> #include <a_mysql> |
#if !defined _included_a_samp
#error I think you forgot to include a_samp
#endif
#if !defined _included_a_mysql
#error I think you forgot to include a_mysql
#endif
"Do not edit, even bugs"
PHP код:
|