Новогодний квест "Доставка подарков"

NozmaD

Администратор
Команда форума
Администратор
Сообщения
164
Баллы
208
Задача взять фуру на холме и развозить подарки по 4 домам, после чего вернуться на конечную точку за наградой.
Всё интересно и необычно. Фура так уже украшена новогодними подарками.

Награду, естественно, выставлять свою :)

1515109996880.png1515110010610.png


C++:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ Инклуды ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <mxINI> // Стандартный инклуд функционала MxINI
#include <streamer> // Инклуд отвечающий за объекты на сервере
#include <a_actor> // Инклуд для создания актёров

forward podtwo(playerid);//для создания паблика который используется таймером

new podartwo[MAX_PLAYERS char],//работа
time_podtwo[MAX_PLAYERS];//таймер
new Float:podtwo_coord[7][3]=//координаты чекпоинтов
{
    {-384.1343,1300.8185,24.7168},//1
    {-286.2218,1172.6554,19.5450},//2
    {-264.2314,1123.9091,19.6131},
    {-42.6993,1087.7747,19.5810},
    {-33.4983,962.7448,19.3867},
    {-329.3387,1358.5803,55.6078},
    {-329.3387,1358.5803,55.6078}
};
new carvidtwo[3];
new tmpobjid;// Замена текстур

#define COLOR_RED 0xAA3333AA // Красный

public OnGameModeInit()
{
    Create3DTextLabel("Квест:\n{9400D3}Доставка подарков\nПодробнее:{8B008B}Ваша группа\nЕсли нету свободных фур - ожидайте.\n{4B0082}Приятной игры!", 0x8A2BE2FF,-328.9384,1365.9833,55.9949, 100.0, 0, 1 ); // Создаём текст
       carvidtwo[0] = CreateVehicle(455,-322.0347,1353.5492,55.6622,208.0618,0,0,-1);
    tmpobjid = CreateDynamicObject(19054,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14544, "ab_woozieb", "otb_wind", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 10839, "aircarpkbarier_sfse", "banding8_64HV", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], 0.759, -0.230, 1.540, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19055,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14651, "ab_trukstpd", "Bow_bar_pool_tablebase", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], -0.740, -0.230, 1.570, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 4552, "ammu_lan2", "sunsetammu2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 4552, "ammu_lan2", "sunsetammu1", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], 0.770, -1.430, 1.690, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19057,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14787, "ab_sfgymbits02", "ab_rollmat02", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], -0.740, -1.530, 1.640, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19058,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 2591, "ab_partition1", "ab_fabricCheck2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 16640, "a51", "concreteyellow256 copy", 0);
    SetDynamicObjectMaterial(tmpobjid, 2, 2591, "ab_partition1", "ab_fabricCheck2", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], -0.620, -2.870, 1.489, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19054,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 3065, "bballx", "bball_fake_light", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 14806, "bdupshifi", "Bdup2_wood", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], 0.760, -2.869, 1.480, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 15041, "bigsfsave", "AH_flrdiamonds", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 15041, "bigsfsave", "AH_flroortile9", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], -0.630, -4.030, 0.649, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 4230, "billbrd01_lan", "eris_2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 2212, "burger_tray", "sprunk_cb", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[0], 0.770, -3.990, 0.630, 0.000, 0.000, 0.000);
       //==========================================================================
    carvidtwo[1] = CreateVehicle(455,-329.2984,1366.6826,56.4828,210.2589,0,0,-1);
    tmpobjid = CreateDynamicObject(19054,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14544, "ab_woozieb", "otb_wind", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 10839, "aircarpkbarier_sfse", "banding8_64HV", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], 0.759, -0.230, 1.540, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19055,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14651, "ab_trukstpd", "Bow_bar_pool_tablebase", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], -0.740, -0.230, 1.570, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 4552, "ammu_lan2", "sunsetammu2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 4552, "ammu_lan2", "sunsetammu1", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], 0.770, -1.430, 1.690, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19057,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14787, "ab_sfgymbits02", "ab_rollmat02", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], -0.740, -1.530, 1.640, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19058,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 2591, "ab_partition1", "ab_fabricCheck2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 16640, "a51", "concreteyellow256 copy", 0);
    SetDynamicObjectMaterial(tmpobjid, 2, 2591, "ab_partition1", "ab_fabricCheck2", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], -0.620, -2.870, 1.489, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19054,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 3065, "bballx", "bball_fake_light", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 14806, "bdupshifi", "Bdup2_wood", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], 0.760, -2.869, 1.480, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 15041, "bigsfsave", "AH_flrdiamonds", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 15041, "bigsfsave", "AH_flroortile9", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], -0.630, -4.030, 0.649, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 4230, "billbrd01_lan", "eris_2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 2212, "burger_tray", "sprunk_cb", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[1], 0.770, -3.990, 0.630, 0.000, 0.000, 0.000);
    //==========================================================================
    carvidtwo[2] = CreateVehicle(455,-335.5497,1377.4557,57.2050,210.1698,0,0,-1);
    tmpobjid = CreateDynamicObject(19054,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14544, "ab_woozieb", "otb_wind", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 10839, "aircarpkbarier_sfse", "banding8_64HV", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], 0.759, -0.230, 1.540, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19055,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14651, "ab_trukstpd", "Bow_bar_pool_tablebase", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], -0.740, -0.230, 1.570, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 4552, "ammu_lan2", "sunsetammu2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 4552, "ammu_lan2", "sunsetammu1", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], 0.770, -1.430, 1.690, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19057,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 14787, "ab_sfgymbits02", "ab_rollmat02", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], -0.740, -1.530, 1.640, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19058,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 2591, "ab_partition1", "ab_fabricCheck2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 16640, "a51", "concreteyellow256 copy", 0);
    SetDynamicObjectMaterial(tmpobjid, 2, 2591, "ab_partition1", "ab_fabricCheck2", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], -0.620, -2.870, 1.489, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19054,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 3065, "bballx", "bball_fake_light", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 14806, "bdupshifi", "Bdup2_wood", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], 0.760, -2.869, 1.480, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 15041, "bigsfsave", "AH_flrdiamonds", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 15041, "bigsfsave", "AH_flroortile9", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], -0.630, -4.030, 0.649, 0.000, 0.000, 0.000);
    tmpobjid = CreateDynamicObject(19056,0.0,0.0,-1000.0,0.0,0.0,0.0,-1,-1,-1,300.0,300.0);
    SetDynamicObjectMaterial(tmpobjid, 0, 4230, "billbrd01_lan", "eris_2", 0);
    SetDynamicObjectMaterial(tmpobjid, 1, 2212, "burger_tray", "sprunk_cb", 0);
    AttachDynamicObjectToVehicle(tmpobjid, carvidtwo[2], 0.770, -3.990, 0.630, 0.000, 0.000, 0.000);
    return true;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9565)//если используете скрипт как фс,то замените на свободный ид диалога в своём моде
    {
        if(response)//начать
        {
            if(podartwo{playerid} == 0)
            {
                SendClientMessage(playerid,0xFFFFFFFF,!"ЭЛЬФ: Привет!Нужно срочно доставить подарки детям.");
                SendClientMessage(playerid,0xFFFFFFFF,!"ЭЛЬФ: Времени совсем нет,поэтому поторопись!");
                SendClientMessage(playerid,0xFFFFFFFF,!"ЭЛЬФ: Едь и постарайся успеть доставить все подарки!");
                SendClientMessage(playerid,0xFFFFFFFF,!"ЭЛЬФ: Только из машины ни шагу!");
                SendClientMessage(playerid,0xAA3333FF,!"Отправляйтесь к метке на карте! У вас есть 10 минут на это задание.");
                SetPlayerCheckpoint(playerid,-320.4793,1322.4800,53.2496,2.0);//включаем 1 чекпоинт
                time_podtwo[playerid] = SetTimer(!"job",550000,false);//на задание даётся 10 мин,если мы не выполнили работу в течении 10 минут задание проваливается
                return 1;
            }
        }
        else//закончить
        {
            SendClientMessage(playerid,0xFFFFFFFF,!"Вы отказались от квеста.");
            podartwo{playerid} = 0;//обнуляем переменную
            DisablePlayerCheckpoint(playerid);//удаляем чекпоинт
            return 1;
        }
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    podartwo{playerid} =
    time_podtwo[playerid] = 0;
    return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) >= carvidtwo[0] && GetPlayerVehicleID(playerid) <= carvidtwo[2])//проверка на взял ли игрок квест
        {
            SendClientMessage(playerid, COLOR_RED, "Этот квест является зимним дополнением к 1 части обновления.Подробно: vk.com/magrpg");
            ShowPlayerDialog(playerid,9565,DIALOG_STYLE_MSGBOX,"{FF0000}Выбор",!"{00FF00}Что вы хотите?",!"Начать",!"Закончить");//если игрок использует пикап то отправляем игроку диалог
            return 1;
        }
    }
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    podartwo{playerid} = 0;//обнуляем переменную
    DisablePlayerCheckpoint(playerid);//удаляем чекпоинт
    KillTimer(time_podtwo[playerid]);//убиваем таймер
}

public podtwo(playerid)// паблик таймера(через 10 минут вызывается этот паблик если мы не выполним задание)
{
    SendClientMessage(playerid,0xFF0000FF,!"Вы не успели доставить газеты подписчикам в срок!");
    podartwo{playerid} = 0;//обнуляем переменную
    RemovePlayerAttachedObject(playerid,0);//удаляем рюкзак
    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
    DisablePlayerCheckpoint(playerid);//удаляем чекпоинт работы
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(podartwo{playerid} >= 0 && GetPlayerVehicleID(playerid) >= carvidtwo[0] && GetPlayerVehicleID(playerid) <= carvidtwo[2])//проверка на то сидит ли игрок на велосипеде
    {
        podartwo{playerid} ++;
        DisablePlayerCheckpoint(playerid);
        switch(podartwo{playerid})
        {
            case 3,4,5,6:
            {
                {
                    switch(podartwo{playerid})
                    {
                        case 3:SendClientMessage(playerid,0xFFFFFFFF,!"Доставлено подарков: {00FF00}1{FFFFFF}/{FF0000}4");
                        case 4:SendClientMessage(playerid,0xFFFFFFFF,!"Доставлено подарков: {00FF00}2{FFFFFF}/{FF0000}4");
                        case 5:SendClientMessage(playerid,0xFFFFFFFF,!"Доставлено подарков: {00FF00}3{FFFFFF}/{FF0000}4");
                        case 6:
                        {
                            SendClientMessage(playerid,0xFFFFFFFF,!"Доставлено подарков: {00FF00}4{FFFFFF}/{FF0000}4");
                            SendClientMessage(playerid,0xAA3333FF,!"Отправляйтесь за наградой!");
                        }
                    }
                    DisablePlayerCheckpoint(playerid);
                    SetPlayerCheckpoint(playerid,podtwo_coord[podartwo{playerid}-1][0],podtwo_coord[podartwo{playerid}-1][1],podtwo_coord[podartwo{playerid}-1][2],6.0);//даём координаты игроку из массива podtwo_coord
                    return 1;
                }
            }
            case 7:
            {
                podartwo{playerid} = 0;
                DisablePlayerCheckpoint(playerid);
                //награда(меняйте на своё)
                SendClientMessage(playerid,0xFFFF00AA,"");
                SendClientMessage(playerid,0xFFFF00AA,"ЭЛЬФ:");
                SendClientMessage(playerid,0x33CCFFAA,"Вы доставили подарки детям и получили:");
                SendClientMessage(playerid,0xFF9900AA," Деньги:{00FF00}100к!");
                SendClientMessage(playerid,0xFFFF00AA,"Опыт:{00FF00}6 exp!");
                SendClientMessage(playerid,0xFFFF00AA,"Приходите через час!");
                SendClientMessage(playerid,0xFFFF00AA,"");
                //
                SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                return 1;
            }
        }
        SetPlayerCheckpoint(playerid,podtwo_coord[podartwo{playerid}-1][0],podtwo_coord[podartwo{playerid}-1][1],podtwo_coord[podartwo{playerid}-1][2], 6.0);
    }
    else//если мы проезжаем чекпоинт на другом транспорте,а не велосипеде то провал работы
    {
        SendClientMessage(playerid,0xFF0000FF,"");
        SendClientMessage(playerid,0xFF0000FF,!"Вы должны быть в фуре!Вы провалили квест 'Доставка подарков'!");
        SendClientMessage(playerid,0xFF0000FF,"");
        podartwo{playerid} = 0;//обнуляем переменную
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
        DisablePlayerCheckpoint(playerid);//удаляем чекпоинты
        KillTimer(time_podtwo[playerid]);//убиваем таймер(10 минут )
        return 1;
    }
    return 1;
}
 
Верх