01.11.2016, 06:16
PHP код:
CMD:createfaction(playerid, params[])
{
if(pInfo[playerid][pLevel] >= 5)
{
new id,name[50],fac = FacCount;
if(sscanf(params,"us[50]",id,name)) return SCM(playerid,COLOR_ORANGE,"USAGE: /createfaction (playerid) (faction name)");
if(fac >= MAX_FACTIONS) return SCM(playerid,COLOR_RED,"Max faction limit reached!");
if(pInfo[id][flevel] == 0)
{
new Query[128];
format(Query, sizeof(Query), "INSERT INTO `Faction` (`Name`, `ID`, `Owner`, `Levels`, `InviteRank`, `KickRank`) VALUES('%s', '%d', '%s', '%d', '%d', '%d')", name, FacCount, PN(id), 10, 7, 7);
db_query(Database, Query);
pInfo[id][flevel] = 10;
pInfo[id][fname] = name;
pInfo[id][pfacno] = FacCount;
FactionInfo[fac][del] = 0;
SaveStatus(id);
new string[120];
format(string,sizeof(string),"You created a faction for %s with name %s.",PN(id),name);
SCM(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"Administrator %s has created a faction for you with name %s.",PN(playerid),name);
SCM(id,COLOR_YELLOW,string);
FacCount++;
}
}
return 1;
}