Привет, Гость!
  • Страница 1 из 1
  • 1
Форум pawno » Pawno » Готовые решения » Работа дальнобойщика (норм.)
Работа дальнобойщика
BicbaiДата: Воскресенье, 02.09.2012, 15:19 | Сообщение # 1
Полковник
Группа: Администратор
Сообщений: 288
Статус: Offline
В начало, вставим пару дефайнов для цвета:

Code
#define RED 0xFF0000AA
#define YELLOW 0xFFFF00AA


И форвард для таймера:

Code
forward RazgruzFurui(playerid);


Затем к переменным, добавим:

Code
new Fura[2],Pricep[10],Text3D:Pricep3dtext[10],Checkpoint[MAX_PLAYERS];


Если вы вписываете в мод, то в OnGameModeInit, если же как скрипт, то в OnFilterScriptInitвставляем:

Code
Fura[0] = AddStaticVehicleEx(515,12.1930,-224.1917,6.4553,90.0913,-1,-1,180); // Фура № 1
AddStaticVehicleEx(515,12.2435,-232.4889,6.4411,89.7957,-1,-1,180); // Фура № 2
AddStaticVehicleEx(515,12.2912,-240.7080,6.4506,89.8790,-1,-1,180); // Фура № 3
AddStaticVehicleEx(403,12.8029,-248.9818,6.0362,90.7330,-1,-1,180); // Фура
AddStaticVehicleEx(403,12.9481,-257.2370,6.0355,90.5530,-1,-1,180); // Фура
AddStaticVehicleEx(403,12.8305,-265.2685,6.0354,89.7056,-1,-1,180); // Фура
AddStaticVehicleEx(514,-18.8261,-220.4126,6.0162,175.5331,-1,-1,180); // Фура
AddStaticVehicleEx(514,-26.6368,-219.4905,6.0159,175.7046,-1,-1,180); // Фура
Fura[1] = AddStaticVehicleEx(514,-34.4157,-218.6096,6.0108,175.0944,-1,-1,180); // Фура
Pricep[0] = AddStaticVehicleEx(435,-55.1299,-224.4092,6.0257,266.6206,-1,-1,180); // Прицеп № 1
Pricep[1] = AddStaticVehicleEx(435,-23.1413,-274.3386,6.0080,180.5373,-1,-1,180); // Прицеп № 2
Pricep[2] = AddStaticVehicleEx(435,-14.7631,-274.5206,6.0191,180.1252,-1,-1,180); // Прицеп № 3
Pricep[3] = AddStaticVehicleEx(584,-61.6196,-321.5299,6.0160,270.4092,-1,-1,180); // Прицеп
Pricep[4] = AddStaticVehicleEx(591,-61.4658,-307.4087,6.0192,270.4079,-1,-1,180); // Прицеп
Pricep[5] = AddStaticVehicleEx(450,-1.2615,-339.9842,6.0233,89.0408,-1,-1,180); // Прицеп
Pricep[6] = AddStaticVehicleEx(450,-1.2152,-322.3202,6.0038,89.9523,-1,-1,180); // Прицеп
Pricep[7] = AddStaticVehicleEx(450,-1.1001,-301.1582,6.0088,89.6910,-1,-1,180); // Прицеп
Pricep[8] = AddStaticVehicleEx(591,-116.4185,-322.6622,2.0134,179.6741,-1,-1,180); // Прицеп
Pricep[9] = AddStaticVehicleEx(584,-231.7576,-190.1307,2.0194,259.2906,-1,-1,180); // Прицеп
Pricep3dtext[0] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Аммуниция{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[0], Pricep[0], 0.0, 0.0, 0.0);
Pricep3dtext[1] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Спиртные напитки{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[1], Pricep[1], 0.0, 0.0, 0.0);
Pricep3dtext[2] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Одежда{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[2], Pricep[2], 0.0, 0.0, 0.0);
Pricep3dtext[3] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Бензин{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[3], Pricep[3], 0.0, 0.0, 0.0);
Pricep3dtext[4] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Замороженные продукты{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[4], Pricep[4], 0.0, 0.0, 0.0);
Pricep3dtext[5] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Щебень{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[5], Pricep[5], 0.0, 0.0, 0.0);
Pricep3dtext[6] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Песок{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[6], Pricep[6], 0.0, 0.0, 0.0);
Pricep3dtext[7] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Известняк{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[7], Pricep[7], 0.0, 0.0, 0.0);
Pricep3dtext[8] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Замороженные продукты{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[8], Pricep[8], 0.0, 0.0, 0.0);
Pricep3dtext[9] = Create3DTextLabel("{ffa500}[Груз: {FFFFFF}Бензин{ffa500}]", YELLOW, 0.0, 0.0, -100.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(Pricep3dtext[9], Pricep[9], 0.0, 0.0, 0.0);


Теперь сделаем команды. В OnPlayerCommandText:

Code
if(strcmp("/daltp", cmdtext, true, 10) == 0)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2.6937,-256.4706,5.4297);
SendClientMessage(playerid,-1,"{FFFF00}Чтобы начать работу дальнобойщика, сядьте в грузовик, подберите любой прицеп и наберите{FF0000}/Dalnstart");
return 1;
}
if(strcmp("/dalnstart", cmdtext, true, 10) == 0)
{

     if(IsPlayerInRangeOfPoint(playerid,200.0,-75.1052,-289.7339,6.4286))
         {
                 new model = GetVehicleModel(GetPlayerVehicleID(playerid));
                 if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && model==515 || GetPlayerState(playerid) != PLAYER_STATE_DRIVER && model==514 || GetPlayerState(playerid) != PLAYER_STATE_DRIVER && model==403)
                 {
                         SendClientMessage(playerid,RED,"Вы должны быть в Фуре за рулём!");
                         return true;
                 }
                 if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                 {
                         SendClientMessage(playerid,RED,"Вы не подцепили прицеп!");
                         return true;
                 }
                 DisablePlayerCheckpoint(playerid);
                 GameTextForPlayer(playerid, "~r~Goto redmarker", 2500, 1);
                 Checkpoint[playerid] = 1;
                 new traileid = GetVehicleTrailer(GetPlayerVehicleID(playerid));
                 if(traileid == Pricep[5] || traileid == Pricep[6] || traileid == Pricep[7])
                 {
                         new rand666=random(4);
                         switch (rand666)
                         {
                    case 0:SetPlayerCheckpoint(playerid,-2101.1555,208.4684,34.8973,8.0);
                         case 1:SetPlayerCheckpoint(playerid,2801.4639,-2436.1069,13.2421,8.0);
                    case 2:SetPlayerCheckpoint(playerid,2619.9587,833.6466,4.9254,8.0);
                         case 3:SetPlayerCheckpoint(playerid,680.4613,896.6621,-40.3721,8.0);
                 }
                 }
                 if(traileid == Pricep[3] || traileid == Pricep[9])
                 {
                         new rand666=random(4);
                         switch (rand666)
                         {
                    case 0:SetPlayerCheckpoint(playerid,2193.5149,2476.3335,10.8203,8.0);
                         case 1:SetPlayerCheckpoint(playerid,-2442.1062,953.0255,45.2969,8.0);
                         case 2:SetPlayerCheckpoint(playerid,-1624.4644,-2697.6082,48.5391,8.0);
                    case 3:SetPlayerCheckpoint(playerid,1918.5468,-1792.2303,13.3828,8.0);
                         }
                 }
                 if(traileid == Pricep[8] || traileid == Pricep[4])
                 {
                         new rand666=random(4);
                         switch (rand666)
                         {
                    case 0:SetPlayerCheckpoint(playerid,2119.4260,-1826.5001,13.5549,8.0);
                    case 1:SetPlayerCheckpoint(playerid,2073.7229,2225.8416,10.8203,8.0);
                    case 2:SetPlayerCheckpoint(playerid,1383.9170,264.0096,19.5669,8.0);
                    case 3:SetPlayerCheckpoint(playerid,-1802.8058,960.6457,24.8906,8.0);
                         }
                 }
                 if(traileid == Pricep[2])
                 {
                         new rand666=random(4);
                         switch (rand666)
                         {
                    case 0:SetPlayerCheckpoint(playerid,505.3549,-1366.4999,16.1252,8.0);
                    case 1:SetPlayerCheckpoint(playerid,2247.9878,-1663.3557,15.4690,8.0);
                    case 2:SetPlayerCheckpoint(playerid,2105.0955,2248.5913,11.0234,8.0);
                    case 3:SetPlayerCheckpoint(playerid,-1889.1820,874.3929,35.1719,8.0);
                         }
                 }
                 if(traileid == Pricep[1])
                 {
                         new rand666=random(4);
                         switch (rand666)
                         {
                    case 0:SetPlayerCheckpoint(playerid,2303.3145,-1635.1567,14.1720,8.0);
                    case 1:SetPlayerCheckpoint(playerid,1830.3245,-1682.8469,13.1551,8.0);
                    case 2:SetPlayerCheckpoint(playerid,-2244.7861,-87.9356,34.9299,8.0);
                    case 3:SetPlayerCheckpoint(playerid,-2555.2585,191.8923,5.7216,8.0);
                 }
                 }
                 if(traileid == Pricep[0])
                 {
                         new rand666=random(4);
                         switch (rand666)
                         {
                    case 0:SetPlayerCheckpoint(playerid,1363.6267,-1282.4384,13.5469,8.0);
                    case 1:SetPlayerCheckpoint(playerid,2394.5999,-1978.2787,13.1115,8.0);
                    case 2:SetPlayerCheckpoint(playerid,2156.1287,940.5781,10.4309,8.0);
                    case 3:SetPlayerCheckpoint(playerid,-2626.6106,211.0776,4.2099,8.0);
                         }
                 }
         }else{SendClientMessage(playerid,RED,"Вы не находитесь в дальнобое");}
         return 1;
}


Далее идем к public OnPlayerEnterCheckpoint(playerid)

Code
if(Checkpoint[playerid] == 1)
         {
                 if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                 {
                 SendClientMessage(playerid, RED,"Наебать решил? иди ищи прицеп!");
                 DisablePlayerCheckpoint(playerid);
                 return true;
                 }
                 DisablePlayerCheckpoint(playerid);
                 TogglePlayerControllable(playerid,0);
                 SendClientMessage(playerid, RED,"Подождите какое-то време пока разгрузят фуру!");
                 SetTimerEx("RazgruzFurui",25000,false,"i",playerid);
         }
         else if(Checkpoint[playerid] == 2)
         {
         if(IsPlayerInAnyVehicle(playerid))
         {
                         if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                         {
                         SendClientMessage(playerid, RED,"Наебать решил? иди ищи прицеп!");
                         DisablePlayerCheckpoint(playerid);
                         return true;
                         }
                         new zarplata = 10000 + random(10000);
                         new string[64];
                         format(string, sizeof(string), "Вы доставили груз и получили $%d", zarplata);
                         SendClientMessage(playerid, YELLOW,string);
                         GivePlayerMoney(playerid, zarplata);
                         Checkpoint[playerid] = 0;
                 DisablePlayerCheckpoint(playerid);
                 SetVehicleToRespawn(GetVehicleTrailer(GetPlayerVehicleID(playerid)));
                 }
         }


Ну и в конец, вставьте:

Code
public RazgruzFurui(playerid)
{
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, RED,"Разгрузка фуры завершена...");
SendClientMessage(playerid,-1,"Верните прицеп обратно где взяли, там же вам выдадут зарплату за рейс");
Checkpoint[playerid] = 2;
SetPlayerCheckpoint(playerid,-0.8136,-249.4456,5.0401,8.0);
return true;
}
 
Форум pawno » Pawno » Готовые решения » Работа дальнобойщика (норм.)
  • Страница 1 из 1
  • 1
Поиск: