• Страница 1 из 1
  • 1
Форум » PAWNO » Уроки Pawno » [Мануал] Работа дровосека [New] (Новая работа дровосека для вашего мода)
[Мануал] Работа дровосека [New]
Дмитрий Дата: Суббота, 06.04.2013, 10:54 | Сообщение # 1 | Сообщить о нерабочей теме


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

Добрый день уважаемые пользователи.
Выкладывать данную работу для вас от автора: JoinT.

Работа дровосека с сохранением древесины в файл.
Работа поможет вам сделать хорошую экономику, если конечно
вы придумаете что можно делать с деревом.

[spoiler="Скрины"]





[/spoiler]

Цитата
Ко всем new добавим

Код
new drev = 99999999;   
new Text3D:derevo;   
new randswood;   
new bool:PlayerWood[MAX_PLAYERS];   
new bool:startjob3[MAX_PLAYERS];   
new handw[MAX_PLAYERS];   
new timewood[MAX_PLAYERS];   
new htyk[MAX_PLAYERS];   
new woodpick;   
new randomwood[][1] =   
{   
      {31},   
      {63},   
      {45},   
      {38},   
      {21},   
      {63},   
      {54},   
      {47},   
      {46},   
      {36},   
      {43},   
      {35},   
      {71},   
      {57},   
      {68},   
      {29},   
      {59},   
      {63}   
};  


Цитата
Ко всем stock

Код
stock SaveWood()   
      {   
           new iniFile = ini_openFile("wood.ini");   
                 ini_setInteger(iniFile,"drev",drev);   
                 ini_closeFile(iniFile);   
              return true;   
      }   
stock LoadWood()   
      {   
              new iniFile = ini_openFile("wood.ini");   
              ini_getInteger(iniFile,"drev",drev);   
                     ini_closeFile(iniFile);   
              return true;   
      }  


[moder]Это само сохранение значения.[/moder]

Цитата
В public OnDialogResponse

Код
                case 9997:   
                  {   
                      if(response)   
                      {   
                          if(IsACop(playerid) || IsAArm(playerid))return SendClientMessage(playerid, COLOR_GREY, "Вам нельзя работать, вы на дежурстве!");   
                          Delgun(playerid);   
                          ApplyAnimation(playerid,"CHAINSAW","CSAW_1",4.1,1,0,0,1,11000);   
                          PlayerWood[playerid] = true;   
                          SetPlayerSkin(playerid,27);   
                          SetPlayerCheckpoint(playerid,-1930.18,-2362.91,30.76,1.0);   
                          SendClientMessage(playerid, COLOR_LIGHTGREEN, "Вы начали работы Дровосека!");   
                          ClearAnimations(playerid);   
                      }   
                      return true;   
                  }   
                  case 9998:   
                  {   
                       if(response)   
                      {   
                            if(PlayerInfo[playerid][pMember] >= 1)   
                          {   
                     SetPlayerSkin(playerid,PlayerInfo[playerid][pModel]);   
                          }   
                            if(PlayerInfo[playerid][pMember] == 0)   
                            {   
                     SetPlayerSkin(playerid,PlayerInfo[playerid][pChar]);   
                            }   
                          PlayerWood[playerid] = false;   
                             DisablePlayerCheckpoint(playerid);   
                             PlayerInfo[playerid][pCash] += htyk[playerid];   
                             format(string, sizeof(string), "{33AA33}Вы заработали {ffffff}%d${33AA33}. Приходите еще",htyk[playerid]);   
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);   
                             htyk[playerid] = 0;   
                             OnPlayerUpdateRL(playerid);   
                          if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);   
                             if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);   
                             if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);   
                      }   
                      return true;   
                  }  


Цитата
А public OnPlayerSpawn(playerid)

Код
startjob3[playerid] = false;   
         PlayerWood[playerid] = false;  


Цитата
В public OnPlayerEnterCheckpoint(playerid)

Код
      if(PlayerToPoint(1.0, playerid,-1930.18,-2362.91,30.76))   
          {   
              startjob3[playerid] = true;   
              ClearAnimations(playerid);   
              DisablePlayerCheckpoint(playerid);   
              GivePlayerWeapon(playerid, 9, 1);   
              ApplyAnimation(playerid,"CHAINSAW","CSAW_1",4.1,1,0,0,1,11000);   
              handw[playerid] = SetTimerEx("wood",9800,false,"i",playerid);   
              return true;   
          }   
          else if(PlayerToPoint(3.0, playerid,-1991.38,-2382.51,30.63) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)   
          {   
                startjob3[playerid] = false;   
              randswood = random(sizeof(randomwood));   
              htyk[playerid] += randomwood[randswood][0];   
                if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);   
                if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);   
                format(string, sizeof(string), "Древесина разгружена (%dêã). Заработано: %d$",randomwood[randswood][0],htyk[playerid]);   
                SendClientMessage(playerid, -1, string);   
              drev+=randomwood[randswood][0];   
              ApplyAnimation(playerid,"PED","IDLE_tired",4.1,1,0,0,0,2500);   
              SetPlayerCheckpoint(playerid,-1930.18,-2362.91,30.76,1.0);   
              UpdateWood();   
              SaveWood();   
              return true;   
          }  


Цитата
В public OnPlayerPickUpPickup(playerid, pickupid)

Код
if(pickupid ==  woodpick)   
      {   
          if(PlayerWood[playerid] == false)   
          {   
              return SPD(playerid,9997,DIALOG_STYLE_MSGBOX,"{ffcc00}Работа дровосека","{FFFFFF}Вы собираетесь начать работу дровоска","Начать","Отмена");   
          }   
          else   
          {   
              return SPD(playerid,9998,DIALOG_STYLE_MSGBOX,"{ffcc00}Работа дровосека","{FFFFFF}Вы собираетесь покинуть работу дровоска","Покинуть","Отмена");   
          }   
      }  


Цитата
В public OnGameModeInit()

Код
    LoadWood();   
woodpick = CreatePickup(1275, 23,-1956.71,-2409.20,30.63);   
format(texts,sizeof(texts),"{FFFF00}Древесины на складе:{ffffff} %dкг",drev);   
derevo = CreateDynamic3DTextLabel(texts,COLOR_YELLOW3d,-1992.13,-2422.40,45.77,45.0,INVALID_PLAYER_ID,INVALID_PLAYER_ID,0,-1,-1,-1,100.0);  


Цитата
В конец мода:

Код
forward wood(playerid);   
public wood(playerid)   
      {   
          if(startjob3[playerid]== true)   
          {   
               ApplyAnimation(playerid,"PED","IDLE_chat",4.1,0,0,0,1,5150);   
              Delgun(playerid);   
              timewood[playerid] = SetTimerEx("TimeWood",5700,false,"i", playerid);   
          }   
          return true;   
      }   
forward TimeWood(playerid);   
public TimeWood(playerid)   
      {   
          if(startjob3[playerid]== true)   
          {   
               SetPlayerAttachedObject(playerid,2, 1458, 1, -1.034844, 1.116571, -0.065124, 76.480148, 75.781570, 280.952545, 0.575599, 0.604554, 0.624122);   
              SetPlayerAttachedObject(playerid,3, 1463, 1, -0.205007, 1.545087, -0.014800, 171.406829, 96.114616, 0.066009, 0.403667, 1.000000, 1.021239 );    
              SetPlayerCheckpoint(playerid,-1991.38,-2382.51,30.63,3.0);   
          }   
          return true;   
      }   
UpdateWood()   
      {   
          new string[60];   
          format(string,sizeof(string),"{FFFF00}Древесины на складе:{ffffff} %dкг",drev);   
          UpdateDynamic3DTextLabelText(derevo, COLOR_YELLOW3d, string);   
          return true;   
      }  


Теперь скачиваем данный файл - тык
И ставим в папку -
Цитата
scriptfiles
Прикрепления: 1639750.png(18.3 Kb) · 0414371.png(8.4 Kb) · 8144152.png(2.7 Kb) · 9945217.png(3.6 Kb) · 4913686.png(147.0 Kb)


From Russia With Love!
Форум » PAWNO » Уроки Pawno » [Мануал] Работа дровосека [New] (Новая работа дровосека для вашего мода)
  • Страница 1 из 1
  • 1
Поиск: