X-Zisst
Умник
PHP:
Создайте файл lead.ini
PHP:
#define Factions 25 // Количество фракций на вашем сервере
new LeadZan[Factions+1];
new LeadName[Factions+1][24] = {
"Полиция",
"ФБР",
"Армия",
"Здравохранение",
"La Cosa Nostra",
"Yakuza",
"Правительство",
"Хитманы",
"Репортеры",
"Taxi",
"Лицензеры",
"Flaming Cobra Gang",
"Русская Мафия",
"Grove Street Gang",
"El Coronas Gang",
"The Ballas Gang",
"The Rifa Gang",
"Los Santos Vagos Gang",
"Night Racers",
"Street Dogs",
"Колхоз",
"The Crips Gang",
"ЗАО Воcхождение",
"S.W.A.T",
"Алькаида"}; // Здесь заменяем на свои
PHP:
if(strcmp(cmd, "/getlead", true) == 0)
{
new dialoged[2048];
if(PlayerInfo[playerid][pExp] < 2 && PlayerInfo[playerid][pLevel] == 1) return send(playerid,-1,"Вы слишком мало играете у нас на сервере!");
for(new i=1; i < Factions+1; i++)
{
if(LeadZan[i] == 0)
{
strcat(dialoged,LeadName[i-1]);
strcat(dialoged,"{1EF007}(Свободна){FFFFFF}");
if(i != 25) strcat(dialoged,"\n");
}
if(LeadZan[i] == 1)
{
strcat(dialoged,LeadName[i-1]);
strcat(dialoged,"{F01818}(Занята){FFFFFF}");
if(i != 25) strcat(dialoged,"\n");
}
}
ShowPlayerDialog(playerid,521,DIALOG_STYLE_LIST,"Выберите свободную лидерку",dialoged,"Беру","Ненадо");
return 1;
}
PHP:
if(dialogid == 521)
{
if(response)
{
for(new i=1; i < Factions+1; i++)
{
if(listitem == i-1)
{
if(LeadZan[i] == 0)
{
if(PlayerInfo[playerid][pMember] != 0) LeadZan[PlayerInfo[playerid][pMember]] = 0;
if(PlayerInfo[playerid][pLeader] != 0) LeadZan[PlayerInfo[playerid][pLeader]] = 0;
LeadZan[i] = 1;
format(str,256,"Поздравляем! Вы стали лидером фракции: %s", LeadName[i-1]);
send(playerid,-1,str);
PlayerInfo[playerid][pMember] = i;
PlayerInfo[playerid][pLeader] = i;
format(str,256,"Внимание! %s стал лидером фракции %s", Name(playerid), LeadName[i-1]);
SendClientMessageToAll(-1,str);
SpawnPlayer(playerid);
return 1;
}
if(LeadZan[i] == 1)
{
send(playerid,-1,"Извините, данная лидерка{F01818} занята{FFFFFF}.");
}
}
}
}
}
PHP:
LoadLead();
PHP:
SaveLead();
PHP:
new fsdf[32];
stock LoadLead()
{
new iniFile = ini_openFile("lead.ini");
for(new i = 1; i < Factions+1; i++)
{
format(fsdf,32,"LeaderID%d",i);
ini_getInteger(iniFile,fsdf,LeadZan[i]);
}
ini_closeFile(iniFile);
}
stock SaveLead()
{
new iniFile = ini_openFile("lead.ini");
for(new i = 1; i < Factions+1; i++)
{
format(fsdf,32,"LeaderID%d",i);
ini_setInteger(iniFile,fsdf,LeadZan[i]);
}
ini_closeFile(iniFile);
}
