Всем привет.
Может быть кому нибудь понадобится автомат оружия для фракций. Но переменные в проверке на лидера и участника фракции нужно поставить будет свои!

Для начала добавляем enum и массив данных.
PHP код:
enum wCaseInfo
{
    
bool:wStatus,
    
wFraction,
    
Float:wPosX,
    
Float:wPosY,
    
Float:wPosZ,
    
Float:wRPosX,
    
Float:wRPosY,
    
Float:wRPosZ,
    
wVW,
    
wInt,
    
wSlotGun[5],
    
wSlotAmmo[5],
    
wCountActiveSlot,
    
Text3DwLabel
}
new 
WeaponCase[2][wCaseInfo] = {
    {
false1, -1979.0333,107.0666,27.68750.0000000.0000000.00000000},
    {
false3, -1972.9081,107.1658,27.68750.0000000.0000000.00000000}
};
new 
GunsCase[8][2] = 
{
    {
24,1}, //24 - ид оружия, 1 - слот
    
{25,2},
    {
28,3},
    {
29,3},
    {
32,3},
    {
30,4},
    {
31,4},
    {
33,5}
}; 
В public OnGameModeInit() добавим создание объекта(автомата).
PHP код:
for(new 0sizeof(WeaponCase); i++)
{
    
CreateDynamicObject(18885WeaponCase[i][wPosX], WeaponCase[i][wPosY], WeaponCase[i][wPosZ], WeaponCase[i][wRPosX], WeaponCase[i][wRPosY], WeaponCase[i][wRPosZ], WeaponCase[i][wVW], WeaponCase[i][wInt]);
    
WeaponCase[i][wLabel] = Create3DTextLabel("Автомат закрыт",0xFFFFFFAA,WeaponCase[i][wPosX], WeaponCase[i][wPosY], WeaponCase[i][wPosZ]+0.5,13.0,WeaponCase[i][wVW],0);

В public OnPlayerCommandText(playerid, cmdtext[]) добавим основную команду.
PHP код:
if(strcmp(cmd"/guns"true) == 0)
{
    if(
pLeader[playerid] != 0// pLeader[playerid] - заменяем на свою переменную лидеров
    
{
        new 
gunname[32],
        
WeaponCaseNum getWeaponCaseNum(playerid);
        static 
string[220];
        
string[0] = EOS;
        
strcat(string"Оружие\tПатроны\tСтатус\n");
        for(new 
0sizeof(GunsCase); i++)
        {
            new 
gunid GunsCase[i][0];
            new 
gunslot GunsCase[i][1];
            
GetWeaponName(gunidgunnamesizeof(gunname));
            
format(stringsizeof(string),"%s%s\t%d\t%s\n",string,gunname,(WeaponCase[WeaponCaseNum][wSlotGun][gunslot-1] == gunid) ? WeaponCase[WeaponCaseNum][wSlotAmmo][gunslot-1]:0,(WeaponCase[WeaponCaseNum][wSlotGun][gunslot-1] == gunid) ? ("{228B22}Открыт"):("{DC143C}Закрыт"));
        }
        
ShowPlayerDialog(playerid,1000,DIALOG_STYLE_TABLIS  T_HEADERS,"Оружейный автомат",string,"Выбрать","Закрыть");
    }
    else return 
SendClientMessage(playerid, -1"Вы не лидер.");
    return 
true;

После этого добавим в public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

PHP код:
if(dialogid == 1000)
{
    if(!
response) return 1;
    for(new 
0sizeof(GunsCase); i++)
    {
        if(
GunsCase[i][0] == getWeaponID(inputtext))
        {
            
SetPVarInt(playerid,"SloteCase", (GunsCase[i][1])-1);
        }
    }
    new 
slot GetPVarInt(playerid,"SloteCase"),
        
WeaponCaseNum getWeaponCaseNum(playerid);
    
    
SetPVarInt(playerid,"GunCase"getWeaponID(inputtext));
    if(
GetPVarInt(playerid,"GunCase") == WeaponCase[WeaponCaseNum][wSlotGun][slot])
    {
        
WeaponCase[WeaponCaseNum][wSlotGun][slot] = 0;
        
WeaponCase[WeaponCaseNum][wSlotAmmo][slot] = 0;
        
WeaponCase[WeaponCaseNum][wCountActiveSlot]--;
        
Update3DTextCase(WeaponCaseNum);
        
DeletePVar(playerid,"GunCase");
        
DeletePVar(playerid,"SloteCase");
        
OnPlayerCommandText(playerid"/guns");
        return 
true;
    }
    else 
ShowPlayerDialog(playerid1001DIALOG_STYLE_INPUT"Автомат оружия""{808080}Примечание:{808080}\n>{FFFFFF} Кол-во патронов не может быть больше 500 и меньше 20.\n\nВведите количество патронов:""Положить""Назад");
    
}
if(
dialogid == 1001)
{
    if(!
response) return OnPlayerCommandText(playerid"/guns");
    if(
strval(inputtext) < 20 || strval(inputtext) > 500) return ShowPlayerDialog(playerid1001DIALOG_STYLE_INPUT"Автомат оружия""{808080}Примечание:{808080}\n>{FFFFFF} Кол-во патронов не может быть больше 500 и меньше 20.\n\nВведите количество патронов:""Положить""Назад");
    
    new 
slot GetPVarInt(playerid,"SloteCase"),
        
WeaponCaseNum getWeaponCaseNum(playerid);
    if(
WeaponCase[WeaponCaseNum][wSlotGun][slot] == 0WeaponCase[WeaponCaseNum][wCountActiveSlot]++;
    
WeaponCase[WeaponCaseNum][wSlotGun][slot] = GetPVarInt(playerid,"GunCase");
    
WeaponCase[WeaponCaseNum][wSlotAmmo][slot] = strval(inputtext);
    
Update3DTextCase(WeaponCaseNum);
    
DeletePVar(playerid,"GunCase");
    
DeletePVar(playerid,"SloteCase");
    
OnPlayerCommandText(playerid"/guns");

В public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
PHP код:
if(newkeys == KEY_WALK)
{
    new 
WeaponCaseNum getWeaponCaseNum(playerid);
    if(
IsPlayerInRangeOfPoint(playerid,1.0,WeaponCase[WeaponCaseNum][wPosX], WeaponCase[WeaponCaseNum][wPosY], WeaponCase[WeaponCaseNum][wPosZ]))
    {
        if(
WeaponCase[WeaponCaseNum][wStatus])
        {
            for(new 
05i++)
            {
                if(
WeaponCase[WeaponCaseNum][wSlotGun][i] != && WeaponCase[WeaponCaseNum][wSlotAmmo][i] != 0)
                {
                    
GivePlayerWeapon(playeridWeaponCase[WeaponCaseNum][wSlotGun][i], WeaponCase[WeaponCaseNum][wSlotAmmo][i]);
                }
            }
        }
        else 
SendClientMessage(playerid, -1"Автомат закрыт!");
    }

Теперь добавим ко всем stock
PHP код:
stock getWeaponCaseNum(playerid)
{
    for(new 
0sizeof(WeaponCase); i++)
    {
        if(
WeaponCase[i][wFraction] == pMember[playerid]) return i//pMember[playerid] - меняем на свою переменную, которая отвечает за нахождение игрока во фракции.
    
}
    return 
true;
}
stock getWeaponID(name[])
{
    if(
strfind(name"Desert Eagle"true) != -1) return 24;
    else if(
strfind(name"Shotgun"true) != -1) return 25;
    else if(
strfind(name"UZI"true) != -1) return 28;
    else if(
strfind(name"MP5"true) != -1) return 29;
    else if(
strfind(name"TEC9"true) != -1) return 32;
    else if(
strfind(name"AK47"true) != -1) return 30;
    else if(
strfind(name"M4"true) != -1) return 31;
    else if(
strfind(name"Rifle"true) != -1) return 33;
    return 
true;
}
stock Update3DTextCase(id)
{
    if(
WeaponCase[id][wCountActiveSlot] == 0) return Update3DTextLabelText(WeaponCase[id][wLabel],0xFFFFFFAA,"Автомат закрыт"), WeaponCase[id][wStatus] = false;
    else
    {
        new 
str[100];
        
strcat(str"Взять: 'Alt'\n\n");
        for(new 
05i++)
        {
            if(
WeaponCase[id][wSlotGun][i] != && WeaponCase[id][wSlotAmmo][i] != )
            {
                new 
gunname[32];
                
GetWeaponName(WeaponCase[id][wSlotGun][i], gunnamesizeof(gunname));
                
format(strsizeof(str),"%s%s x%d\n",str,gunnameWeaponCase[id][wSlotAmmo][i]);
            }
        }
        
Update3DTextLabelText(WeaponCase[id][wLabel],0xEEEE88FF,str);
        if(!
WeaponCase[id][wStatus]) WeaponCase[id][wStatus] = true;
    }
    return 
true;

Так же готов выслушать недочеты по коду.

И вот собственно видео.