17.07.2013, 09:08
PHP код:
YCMD:clan(playerid,params[],help)
{
new cmd[10],cname[MAX_CLAN_NAME],sid[10];
sscanf(params,"s[10]s["#MAX_CLAN_NAME"]s",cmd,cname,sid);
if(!strlen(cmd))
{
SendClientMessage(playerid,-1,"/Clan [Create | Invite | Accept] - щйоещ");
return 1;
}
if(!strcmp(cmd,"create",true))
{
if(!strlen(cname))return SendClientMessage(playerid,-1,"/Clan Create [ClanName] - цешъ дщйоещ");
if(strfind(cname,"None",true) != -1 || !strcmp(cname,"gmR",true) || !strcmp(cname,"LorD",true) || !strcmp(cname,"LoL",true) || !strcmp(cname,"Uk",true) || !strcmp(cname,"JaP",true) || !strcmp(cname,"IsraeL",true) || !strcmp(cname,"NoN",true) || !strcmp(cname,"Fxp",true) || !strcmp(cname,"SAMP-IL",true) || !strcmp(cname,"Vgames",true) || !strcmp(cname,"WaR",true) || !strcmp(cname,"QeeR",true))return SendClientMessage(playerid,Red,".ма рйъп мфъез чмап бщн жд");
if(strlen(cname) > MAX_CLAN_NAME || strlen(cname) < 2)return SendClientMessage(playerid,Red,".аешк щн дчмап цшйк мдйеъ бйп 2-6 ъеейн");
if(IsClanExists(cname))return SendClientMessage(playerid,Red,".чййн лбш чмап бщн жд");
if(pInfo[playerid][ClanID] != -1)return SendClientMessage(playerid,Red,"дйрк роца лбш бчмап");
//ClanCreate
ClanInfo[CountClans][ClanID] = CountClans;
format(ClanInfo[CountClans][ClanName],MAX_CLAN_NAME,"%s",cname);
ClanInfo[CountClans][Color] = rgba2hex(random(255),random(255),random(255),100);
format(ClanInfo[CountClans][cFounder],30,"%s",GetName(playerid));
ClanInfo[CountClans][CPlayers] = 1;
ClanInfo[CountClans][Tests] = true;
ClanInfo[CountClans][Bank] = 0;
ClanInfo[CountClans][BankState] = true;
ClanInfo[CountClans][cPosX] = 0.00000;
ClanInfo[CountClans][cPosY] = 0.00000;
ClanInfo[CountClans][cPosZ] = 0.00000;
ClanInfo[CountClans][cPosA] = 0.00000;
ClanInfo[CountClans][cvPosX] = 0.00000;
ClanInfo[CountClans][cvPosY] = 0.00000;
ClanInfo[CountClans][cvPosZ] = 0.00000;
ClanInfo[CountClans][cvPosA] = 0.00000;
ClanInfo[CountClans][Chat] = true;
ClanInfo[CountClans][HaveHQ] = false;
ClanInfo[CountClans][AntiTeamKill] = false;
ClanInfo[CountClans][TeamKillID] = CountClans+4*6+random(6000)+random(89014);
ClanInfo[CountClans][CMaxWithdraw] = 20000;
ClanInfo[CountClans][CMaxDeposit] = 1000000;
ClanInfo[CountClans][ShowList] = true;
INI_Create(ClanFile(CountClans));
new INI:ini = INI_Open(ClanFile(CountClans),ini_mode_write);
INI_WriteInt(ini,"ClanID",CountClans);
INI_WriteString(ini,"ClanName",cname);
INI_WriteInt(ini,"ClanColor",ClanInfo[CountClans][Color]);
INI_WriteString(ini,"ClanFounder",GetName(playerid));
INI_WriteInt(ini,"ClanPlayers",1);
INI_WriteBool(ini,"ClanTests",true);
INI_WriteInt(ini,"ClanBank",0);
INI_WriteBool(ini,"ClanBankState",true);
INI_WriteFloat(ini,"ClanPosX",0.00000);
INI_WriteFloat(ini,"ClanPosY",0.00000);
INI_WriteFloat(ini,"ClanPosZ",0.00000);
INI_WriteFloat(ini,"ClanPosA",0.00000);
INI_WriteFloat(ini,"ClanvPosX",0.00000);
INI_WriteFloat(ini,"ClanvPosY",0.00000);
INI_WriteFloat(ini,"ClanvPosZ",0.00000);
INI_WriteFloat(ini,"ClanvPosA",0.00000);
INI_WriteBool(ini,"ClanChat",true);
INI_WriteBool(ini,"ClanHQ",false);
INI_WriteBool(ini,"AntiTeamKill",false);
INI_WriteInt(ini,"ClanTeamID",CountClans+4*6+random(6000)+random(89014));
INI_WriteInt(ini,"MaxWithdraw",20000);
INI_WriteInt(ini,"MaxDeposit",1000000);
INI_WriteBool(ini,"ShowList",true);
INI_Close(ini);
GivePlayerMoney(playerid,-800000);
pInfo[playerid][ClanID] = CountClans;
pInfo[playerid][ClanLevel] = Clan_Founder;
format(pInfo[playerid][ClanName], 32, "%s", cname);
new String[1400];
format(String,sizeof(String),"» {%s}%s{FFD700} - йцшъ чмап згщ бщн\n{FF8C00} ~ ойгт тм дчмап ~ \n{AFEEEE}•{9ACD32} %s{FFD700} :щн дчмап\n",ReturnHexColour(ClanInfo[CountClans][Color]),cname,cname);
format(String,sizeof(String),"%s{AFEEEE}•{9ACD32} %d{FFD700} :осфш дчмап\n{AFEEEE}•{9ACD32} %s{FFD700} :оййсг дчмап\n{AFEEEE}•{9ACD32} оцб дчмап мисийн: %s",String,CountClans,GetName(playerid),ClanInfo[CountClans][Tests]?("фъез мисийн"):("свеш мисийн"));
ShowPlayerDialog(playerid,random(100000)+8001561+random(2000),DIALOG_STYLE_MSGBOX,"{FF8C00}Clan System - отшлъ дчмап",String,"свеш","");
SetPlayerColor(playerid,ClanInfo[CountClans][Color]);
++CountClans;
//dini_IntAdd("NDM/Settings.ini", "CountClans", 1);
return 1;
}
if(!strcmp(cmd,"Invite",true))
{
if(!strlen(sid))return SendClientMessage(playerid,-1,"/Clan Invite [id/name] - цешъ дщйоещ");
new id = strval(sid);
if(!IsPlayerInClan(playerid))return SendClientMessage(playerid,Red,".айрк роца бчмап");
if(pInfo[playerid][ClanLevel] < Clan_Tester)return SendClientMessage(playerid,Red,".тмййк мдйеъ исиш дчмап блгй мдщъощ бфчегд же");
if(!IsPlayerConnected(id))return SendClientMessage(playerid,Red,".щзчп ма озебш");
if(!ClanInfo[pInfo[playerid][ClanID]][Tests])return SendClientMessage(playerid,Red,".дчмап щмк свеш мисийн");
//if(pInfo[id][Level] < 2)return SendClientMessage(playerid,Red,".щзчп жд бшод роелд о-2");
if(pInfo[playerid][ClanID] == pInfo[id][ClanID])return SendClientMessage(playerid,Red,".щзчп жд роца лбш бчмап щмк");
if(IsPlayerInClan(id))return SendClientMessage(playerid,Red,".щзчп жд роца лбш бчмап");
pInfo[id][InvitedClan] = pInfo[playerid][ClanID];
SendFormatMessage(playerid,Green,".\"%s\" щмзъ джорд мщзчп",GetName(id));
SendFormatMessage(id,Green,"\"%s\" джойп аеък мчмап \"%s\" дщзчп",ClanInfo[pInfo[playerid][ClanID]][ClanName],GetName(playerid));
SendClientMessage(id,Green,"/Clan Accept - тм оръ мащш джорд же дщъощ бфчегд");
return 1;
}
if(!strcmp(cmd,"Accept",true))
{
if(IsPlayerInClan(playerid))return SendClientMessage(playerid,Red,".аъд роца лбш бчмап шйщой");
if(pInfo[playerid][InvitedClan] == -1)return SendClientMessage(playerid,Red,".ма дежоръ мщен чмап шйщой");
pInfo[playerid][ClanID] = pInfo[playerid][InvitedClan];
pInfo[playerid][ClanLevel] = 1;
format(pInfo[playerid][ClanName],MAX_CLAN_NAME,"%s",ClanInfo[pInfo[playerid][ClanID]][ClanName]);
ClanInfo[pInfo[playerid][ClanID]][CPlayers]++;
pInfo[playerid][InvitedClan] = -1;
foreach(new i:Player)
{
if(IsPlayerInClan(playerid) && IsPlayerInClan(i) && pInfo[playerid][ClanID] == pInfo[i][ClanID] && i!=playerid)
{
SendFormatMessage(i,Orange,".дцишу мчмап щмк \"%s\" дщзчп",GetName(playerid));
}
}
SendFormatMessage(playerid,Green,".\"%s\" дцишфъ мчмап",ClanInfo[pInfo[playerid][ClanID]][ClanName]);
return SetPlayerColor(playerid,ClanInfo[pInfo[playerid][ClanID]][Color]);
}
return 1;
}