04.07.2013, 09:47
(
Последний раз редактировалось FuznesS; 05.07.2013 в 10:06.
)
Solved, can deleted.
CMD:clan(playerid, params[])
{
new param_0[24], param_1[24], string[256];
if(sscanf(params, "s[10]S[25]", param_0, param_1)) return SendClientMessage(playerid, -1, "[Command] /clan [command]");
if(!strcmp(param_0, "create", true))
{
if(strlen(param_1) == 0) return SendClientMessage(playerid, -1, "[Command] /clan create [name]");
format(ClanFile, sizeof(ClanFile), "NewDM/Clans/%s.ini",cname);
if(DOF2_GetInt(UserPath(playerid),"InClan") == 1) return SendClientMessage(playerid, -1, "You are already in clan.");
if(DOF2_FileExists(ClanFile)) return SendClientMessage(playerid, -1, "This clan name is already exists, please pick another name.");
if(GetPlayerMoney(playerid) < 150000) return SendClientMessage(playerid, -1, "You don't have enough money to create clan - $150,000.");
DOF2_CreateFile(ClanFile);
DOF2_SetString(ClanFile, "ClanName", cname);
DOF2_SetString(ClanFile, "Leader", GetName(playerid));
//======================================================================
DOF2_SetString(UserPath(playerid), "ClanName", cname);
DOF2_SetInt(UserPath(playerid), "InClan", 1);
DOF2_SetInt(UserPath(playerid), "ClanLevel", 5);
GivePlayerMoney(playerid, -150000);
format(string, sizeof(string),"You successfully create (%s) clan.", cname);
SendClientMessage(playerid,COLOR_LIGHTGREEN,string);
SendClientMessage(playerid,COLOR_AQUA,"You are the Founder of the clan.");
SendClientMessage(playerid,COLOR_WHITE,"you can use /clanhelp for more commands.");
DOF2_SaveFile();
}
if(!strcmp(param_0, "invite", true))
{
new ID;
if(strlen(param_1) == 0) return SendClientMessage(playerid, -1, "[Command] /clan invite [ID]");
ID = strval(param_1);
if(DOF2_GetInt(UserPath(playerid),"InClan") == 0) return SendClientMessage(playerid, -1, "You not own any clan.");
if(DOF2_GetInt(UserPath(playerid),"ClanLevel") < 5) return SendClientMessage(playerid, -1, "Your clan level is not high enough.");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED, "This player is offline.");
if(ID == playerid)SendClientMessage(playerid,COLOR_RED,"You can't invite yourself to the clan.");
if(DOF2_GetInt(UserPath(ID), "InClan") == 1) return SendClientMessage(playerid, COLOR_RED, "This player already in clan.");
format(string, sizeof(string),"You invited (%s) to your clan", GetName(ID));
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
format(string,sizeof(string),"Player (%s) invited you to his clan (%s).", GetName(playerid), PlayerInfo[playerid][pClanName]);
SendClientMessage(ID,COLOR_LIGHTGREEN,string);
SendClientMessage(ID,COLOR_GREEN,"If you want to join his clan use /clan join.");
ClanInviter[ID] = playerid;
InviteToClan[ID] = 1;
}
return 1;
}