• Страница 1 из 1
  • 1
Создаем военный билет
Дмитрий Дата: Пятница, 28.12.2012, 15:29 | Сообщение # 1 | Сообщить о нерабочей теме


Аватар для Дмитрий

Вообщем,в этом уроке я расскажу как сделать военный билет.
P.S:без него не смогут принять в FBI,SAPD,Мэрию.
Сначала в enum pInfo добавляем

Код
pVoenBilet,  


Далее в public OnPlayerConnect(playerid)
добавляем

Код
PlayerInfo[playerid][pVoenBilet] = 0;  


Потом в public OnPlayerRegister(playerid, password[])
добавляем

Код
iniSetInt(File,"VoenBilet",PlayerInfo[playerid][pVoenBilet]);  


в public OnPlayerUpdate_GF(playerid) аналогично добавляем

Код
iniSetInt(File,"VoenBilet",PlayerInfo[playerid][pVoenBilet]);  


Также в public OnPlayerLogin(playerid,password[]) добавим

Код
iniGetInt(File,"VoenBilet",PlayerInfo[playerid][pVoenBilet]);  


Дальше в команду /invite добавим

Код
   if (gTeam[para1]==TEAM_GREEN && PlayerInfo[para1][pMember] == 0 && PlayerInfo[para1][pFMember] == 255)
                         {
                             if(PlayerInfo[playerid][pLeader] == 1)
                             {
                    if(PlayerInfo[para1][pVoenBilet] == 0)
                    {
                    SendClientMessage(para1, COLOR_LIGHTBLUE, "*Нет военного билета");
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* У игрока нет военного билета");
                    return 1;
                    }
                    else PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "L.S.P.D"; ChosenSkin[para1] = 280; SetPlayerSkin(para1, 280);
                             }  


Вот команда выдачи,отнятия,показания военного.

Код
if(strcmp(cmd, "/givebilet", true) == 0)
     {
         if(IsPlayerConnected(playerid))
         {
             if(PlayerInfo[playerid][pLeader] == 3)
              {
                 tmp = strtok(cmdtext, idx);
                 if(!strlen(tmp))
                 {
                     SendClientMessage(playerid, COLOR_WHITE, " Используйте: /givebilet [playerid/PartOfName]");
                     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), "* Лидер %s выдал Вам Военный Билет",sendername);
                         SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                         PlayerInfo[giveplayerid][pVoenBilet] = 1;
                         return 1;
                     }
                 }
             }
             else
             {
                 SendClientMessage(playerid, COLOR_GREY, "Нет такого игрока!");
                 return 1;
             }
         }
     }
     if(strcmp(cmd, "/takebilet", true) == 0)
     {
         if(IsPlayerConnected(playerid))
         {
             if(PlayerInfo[playerid][pLeader] == 3)
              {
                 tmp = strtok(cmdtext, idx);
                 if(!strlen(tmp))
                 {
                     SendClientMessage(playerid, COLOR_WHITE, " Используйте: /takebilet [playerid/PartOfName]");
                     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), "*Лидер %sзабрал Ваш Военный Билет",sendername);
                         SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                         PlayerInfo[giveplayerid][pVoenBilet] = 0;
                         return 1;
                     }
                 }
             }
             else
             {
                 SendClientMessage(playerid, COLOR_GREY, "Нет такого игрока!");
                 return 1;
             }
         }
     }
     if(strcmp(cmd,"/showbilet",true)==0||strcmp(cmd,"/sb",true)==0)
     {
         if(IsPlayerConnected(playerid))
         {
             tmp = strtok(cmdtext, idx);
             if(!strlen(tmp))
             {
                 SendClientMessage(playerid, COLOR_WHITE, " Используйте: /sb [playerid/PartOfName]");
                 return 1;
             }
             giveplayerid = ReturnUser(tmp);
             if(IsPlayerConnected(giveplayerid))
             {
                 if(giveplayerid != INVALID_PLAYER_ID)
                 {
                     if (ProxDetectorS(8.0, playerid, giveplayerid))
                     {
                         if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Вы не можете показать себе Военный Билет!"); return 1; }
                         GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                         GetPlayerName(playerid, sendername, sizeof(sendername));
                         new text1[20];
                         if(PlayerInfo[playerid][pVoenBilet]) { text1 = "Отслужил"; } else { text1 = "Не служил"; }
                         format(string, sizeof(string), "|__________ Билет %s __________|", sendername);
                         SendClientMessage(giveplayerid, COLOR_WHITE, string);
                         format(string, sizeof(string), "**Военный Билет: %s.", text1);
                         SendClientMessage(giveplayerid, COLOR_GREY, string);
                         format(string, sizeof(string), "* %s показал Вам Военный Билет.", sendername);
                         SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                         format(string, sizeof(string), "* Вы показали свой Военный Билет %s.", giveplayer);
                         SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                     }
                     else
                     {
                         SendClientMessage(playerid, COLOR_GREY, "   Игрок не около Вас !");
                         return 1;
                     }
                 }
             }
             else
             {
                 SendClientMessage(playerid, COLOR_GREY, "   Этот игрок не в сети !");
                 return 1;
             }
         }
         return 1;
      }  


Дальше так же аналогично сами.


From Russia With Love!
  • Страница 1 из 1
  • 1
Поиск: