- Регистрация
- 14 Июн 2019
- Сообщения
- 10
- Лучшие ответы
- 0
- Репутация
- 0
Приветствую, помогите сделать автопринятие во фракцию, чтобы прописываешь команду и автоматически принимало во фраку.
Заранее спасибо.
Вот команда /invite
Заранее спасибо.
Вот команда /invite
PHP:
CMD:invite(playerid, params[])
{
if(!pInfo[playerid][pTempLeader])
{
if(!IsAbleToInvite(playerid)) return SendClientMessage(playerid, COLOR_GREY, YouCanNot);
}
else
{
if(pInfo[playerid][pAdmin] < ADM_MODER) return SendClientMessage(playerid, COLOR_GREY, "Данная возможность доступна для администраторов 4 уровня и выше");
}
new targetid;
if(sscanf(params, "d", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "{FFFF00}Подсказка:{FFFFFF} /invite [id игрока]");
else if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, PlayerIsNotOnline);
else if(!gPlayerLogged[targetid]) return SendClientMessage(playerid, COLOR_GREY, PlayerIsNotAuthorized);
//else if((IsAGang(playerid) || IsAArmy(playerid)) && pInfo[targetid][pLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "У игрока нету 2 уровня!");
//else if((!IsAGang(playerid) && !IsAArmy(playerid)) && pInfo[targetid][pLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "У игрока нету 3 уровня!");
else if(pInfo[targetid][pWarn] > 0) return SendClientMessage(playerid, COLOR_GREY, "У игрока предупреждение!");
else if(pInfo[targetid][pLeader] > 0) return SendClientMessage(playerid, COLOR_GREY, "Лидера нельзя принимать в организацию!");
else if(pInfo[targetid][pMember] > 0) return SendClientMessage(playerid, COLOR_GREY, "Игрок не состоит в Вашей организации!");
else if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Игрок не должен находиться в транспорте!");
else if(!IsPlayerStream(8.0, playerid, targetid, 1)) return SendClientMessage(playerid, COLOR_GREY, "Игрок слишком далеко!");
SendMes(playerid,COLOR_BLUE,"Вы предлагаете %s присоединиться в вашу организацию",GetName(targetid));
new string[128];
format(string,sizeof(string),"%s %s предлагает вам присоединиться к \"%s\"\n\nВы согласны?",Fraction_Rang[pInfo[playerid][pMember]][pInfo[playerid][pRank]], GetName(playerid), Fraction_Name[pInfo[playerid][pMember]]);
ShowPlayerDialogEx(targetid, dInviteFrac, 0, "{FFFF00}Вступление во фракцию",string,"Да","Нет");
SetPVarInt(targetid, "offerfractionid", pInfo[playerid][pMember]);
SetPVarInt(targetid, "offerplayer", playerid);
SetPVarInt(playerid, "actplayerid", targetid);
return 1;
}
PHP:
case dInviteFrac:
{
if(!response)
{
DeletePVar(playerid, "offerplayer");
DeletePVar(playerid, "offerfractionid");
return 1;
}
new fractionid = GetPVarInt(playerid, "offerfractionid");
new offer = GetPVarInt(playerid, "offerplayer");
new mes[128];
for(new i; i < 9; i++)
{
new skinid = Fraction_Skin[fractionid][i];
if(!skinid) break;
if(!i) format(mes, sizeof(mes), "Скин %d [%d]", i+1, skinid);
else format(mes, sizeof(mes), "%s\nСкин %d [%d]", mes, i+1, skinid);
}
SendClientMessage(playerid, COLOR_BLUE, "Ждите, пока лидер выберет одежду для Вас");
ShowPlayerDialogEx(offer, dInviteSkin, 2, "{FFFF00}Выбор скина", mes, "Принять", "");
}
case dInviteSkin:
{
if(!response) return 1;
new actplayerid = GetPVarInt(playerid, "actplayerid");
new fractionid = GetPVarInt(actplayerid, "offerfractionid");
new skinid = Fraction_Skin[fractionid][listitem];
new string[128];
format(string, sizeof(string), "Вы присоединились к организации \"%s\"", Fraction_Name[fractionid]);
SendClientMessage(actplayerid, COLOR_BLUE, string);
format(string, sizeof(string), "%s принял%s предложение присоединиться к \"%s\"", GetName(actplayerid), (pInfo[actplayerid][pSex]==1)?(""):("а"), Fraction_Name[fractionid]);
SendClientMessage(playerid, COLOR_BLUE, string);
format(string, sizeof(string), "%s пригласил%s %s в организацию", GetName(playerid), (pInfo[playerid][pSex]==1)?(""):("а"), GetName(actplayerid));
SendFracMes(pInfo[playerid][pMember], COLOR_YELLOW, string);
format(string, sizeof(string), "%s новый член организации", GetName(actplayerid));
SendFracMes(pInfo[playerid][pMember], COLOR_ORANGE, string);
pInfo[actplayerid][pMember] = fractionid;
pInfo[actplayerid][pRank] = 1;
pInfo[actplayerid][pMemberSkin] = skinid;
SetPlayerSkin(actplayerid, skinid);
pInfo[actplayerid][pJob] = JOB_NONE;
mysql_query_string[0] = EOS;
format(mysql_query_string, 300, "UPDATE "T_ACCOUNTS" SET member = %i, rank = 1, job = 0, memberskin = %i, spawnchange = %i WHERE id = %i", fractionid, pInfo[actplayerid][pMemberSkin], pInfo[actplayerid][pSpawnChange], pInfo[actplayerid][pID]);
mysql_tquery(dbHandle, mysql_query_string, "", "");
SendClientMessage(actplayerid, COLOR_GREEN, "[Подсказка] {FFFFFF}Местом спавна автоматически назначена база организации. Изменить место спавна /setspawn");
SetPlayerColorEx(actplayerid, TeamColors[GetTeamID(actplayerid)]);
ResetPlayerWeaponsEx(actplayerid);
}
Последнее редактирование: