Доступ к архиву

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

[All] Военный билет

Статус
В этой теме нельзя размещать новые ответы.

ByRulik

Умник
Здравствуйте,решил сделать тему как в мод добавить военный билет
На форуме видел только темы с вопросами про него,вот распишу как сделать!
в enum pInfo добавить:
PHP:
pArmBil,
в public OnPlayerConnect добавить:
PHP:
format(var, 64, "ArmBil=%d\n",PlayerInfo[playerid][pArmBil]);fwrite(hFile, var);
в public OnPlayerUpdate добавить:
PHP:
format(var, 64, "ArmBil=%d\n",PlayerInfo[playerid][pArmBil]);fwrite(hFile, var);
в public OnPlayerLogin добавить:
PHP:
if( strcmp( key , "ArmBil" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pArmBil] = strval( val ); }
в /take ищем:
PHP:
Driverslicense, Flyinglicense, Boatlicense, Motolicense, Gunlicense, Weapons, Drugs, Materials,
и добавляем Armbil:
PHP:
Driverslicense, Flyinglicense, Boatlicense, Motolicense, Gunlicense, Weapons, Drugs, Materials, Armbil
в /take ищем:
PHP:
else if(strcmp(x_nr,"materials",true) == 0)
перед ним добавляем:
PHP:
          else if(strcmp(x_nr,"armbil",true) == 0)
                        {
                                tmp = strtok(cmdtext, idx);
                                if(!strlen(tmp)) {
                                SendClientMessage(playerid, COLOR_WHITE, " /take armbil [id игрока] ");
                                return 1;
                        }
                                giveplayerid = ReturnUser(tmp);
                        if(IsPlayerConnected(giveplayerid))
                        {
                                if(giveplayerid != INVALID_PLAYER_ID)
                                {
                                if (ProxDetectorS(8.0, playerid, giveplayerid))
                                        {
                                        new giveplayername[64];
                                        GetPlayerName(playerid, sendername, sizeof(sendername));
                                        GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
                                        format(string, sizeof(string), "Bы обнулили военный билет %s.", giveplayername);
                                        SendClientMessage(playerid, COLOR_WHITE, string);
                                        format(string, sizeof(string), "%s обнулил ваш военный билет.", sendername);
                                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                                        PlayerInfo[giveplayerid][pArmBil] = 0;
                                }
                                else
                                        {
                                        SendClientMessage(playerid, COLOR_GREY, " Этот игрок находится далеко от вас ");
                                        return 1;
                                        }
                                }
                        }
                                else
                        {
                                SendClientMessage(playerid, COLOR_GREY, " Под данным id нет никого в игре ");
                                return 1;
                        }
                        }
и добавляем 2 команды в public OnPlayerCommandText:
PHP:
     if(strcmp(cmd, "/givebil", true) == 0)
        {
       if(IsPlayerConnected(playerid))
       {
           if (PlayerInfo[playerid][pLeader] == 3)
           {
                new x_nr[256];
                                x_nr = strtok(cmdtext, idx);
                        if(!strlen(x_nr))
                                {
                                SendClientMessage(playerid, COLOR_WHITE, "/givebil [наименование] [id игрока]");
                                SendClientMessage(playerid, COLOR_WHITE, "Наименования:билет");
                                return 1;
                        }
                        if(strcmp(x_nr,"билет",true) == 0)
                        {
                        tmp = strtok(cmdtext, idx);
                                if(!strlen(tmp))
                                {
                                        SendClientMessage(playerid, COLOR_WHITE, "/givebil билет [id игрока]");
                                        return 1;
                                }
                                giveplayerid = ReturnUser(tmp);
                                if(IsPlayerConnected(giveplayerid))
                                {
                                        if(giveplayerid != INVALID_PLAYER_ID)
                                        {
                                        GetPlayerName(playerid, sendername, sizeof(sendername));
                                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                        format(string, sizeof(string), "Вы выдали %s военный билет",giveplayer);
                                                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                                        format(string, sizeof(string), "Вам выдали военный билет");
                                        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                                        PlayerInfo[giveplayerid][pArmBil] = 1;
                                        return 1;
                                        }
                                }
                                else
                                {
                                        SendClientMessage(playerid, COLOR_GREY, "Под данным id нет никого в игре");
                                        return 1;
                                }
                        }
           }
           else
           {
               SendClientMessage(playerid, COLOR_GREY, "ERROR");
               return 1;
           }
       }
       return 1;
    }
        if(strcmp(cmd,"/showbil",true)==0)
        {
                if(IsPlayerConnected(playerid))
                {
           new text1[120];
           if(PlayerInfo[playerid][pArmBil]) { text1 = "В запасе(пройдена)"; } else { text1 = "Не пройдена(не призван)"; }
           SendClientMessage(playerid, COLOR_WHITE, " __________________ Военный билет __________________");
           format(string, sizeof(string), "Военная служба: %s.", text1);
                SendClientMessage(playerid, COLOR_GREY, string);
                SendClientMessage(playerid, COLOR_GREY, " ______________________________________________");
        }
        return 1;
    }
От +сика не откажусь.
Если было извините невидел.
Автор: Romzis
Доделал:ByRulik
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу