1 post in this topic

Описание: Система довольно простая в визуализации, игрок садится в машину и ему дается 1 минута на взлом машины, но для этого нужно купить у торговца специальную флешку и провода ( цена на них а так-же координаты NPC можно очень просто настроить в моде ), после этого игрок садится в машину, созданную через кастомную функцию h_veh, и появляется панель взлома на текстдравах, игрок должен нажимать на рандомные клавиши Y/N до того, как прогресс панель не дойдет доверху, что бы осложнить этот процесс каждую секунду прогресс взлома падает на 1 деление и каждый неверный ответ отнимает у игрока 5хп. Взломанные машины повторно взламывать не нужно. Система проста в адаптации для любых модов. Система писалась на основе мода: bare

----------------------------------------------------------------------------------------------------------------------------------------------------------------

Спойлер

#define d_hack_car 2000
#define d_buy_hack 2001  

 

Спойлер

// settings
const Float:a_x = 2033.9963, // actor x
    Float:a_y = 1336.3312, // actor y
    Float:a_z = 10.8203, // actor z
    Float:a_angle = 98.0844; // actor angle


const count_cen_1 = 1000, //Цена флешки с вирусами
    count_cen_2 = 1000; //Цена провадов
//

new Float:minus_size[MAX_PLAYERS] = 0.5555, //Поднимаем бокс
    Float:size[MAX_PLAYERS] = -0.705555; //Точка минимума бокса

new PlayerText:h_box_update[MAX_PLAYERS],
    PlayerText:h_text_update[MAX_PLAYERS],
    PlayerText:h_time_update[MAX_PLAYERS];

new Text:h_static_box[8],
    Text:h_text[6];

new hacked_vehicle[MAX_VEHICLES],
    h_vehicle[MAX_VEHICLES],
    h_vehicle_count;

new timer_minus_count[MAX_PLAYERS];

new timer_check[MAX_PLAYERS],
    minus_timer[MAX_PLAYERS] = 1, //Сколько секунд мы отнимаем каждую секунду
    timer_cell[MAX_PLAYERS] = 60; //Время которое мы даем на взлом машины  

 

Спойлер

enum hHack{    pProvod,    pFlesh,    pStatus,    pHacked,    pCountHacked,    pKeyHack} 
new pHackInfo[MAX_PLAYERS][hHack];  

 

Спойлер

       case d_hack_car:
        {
            if(response)
            {
                if(pHackInfo[playerid][pStatus] == 0)
                {
                    SendClientMessage(playerid, -1, "Вы не можете взломать данную машину");
                    return RemovePlayerFromVehicle(playerid);
                }


                PlayerTextDrawShow(playerid, h_box_update[playerid]);
                PlayerTextDrawShow(playerid, h_text_update[playerid]);
                PlayerTextDrawShow(playerid, h_time_update[playerid]);


                for(new i = 0; i < 8; i ++) { TextDrawShowForPlayer(playerid, h_static_box[i]); }
                
                pHackInfo[playerid][pHacked] = 1;
                
                pHackInfo[playerid][pFlesh] = 0;
                pHackInfo[playerid][pProvod] = 0;
                pHackInfo[playerid][pStatus] = 0;
                
                timer_minus_count[playerid] = SetTimerEx("@_Minus_Count",1000,true,"i",playerid);
                
                return TogglePlayerControllable(playerid, false);
            }
            else RemovePlayerFromVehicle(playerid);
        }
        case d_buy_hack:
        {
            if(!response) return true;
            switch(listitem)
            {
                case 0:
                {
                    if(pHackInfo[playerid][pFlesh] == 1) return SendClientMessage(playerid, -1, "У вас уже имеется флешка");
                    if(GetPlayerMoney(playerid) < count_cen_1) return SendClientMessage(playerid, -1, "Недостаточно денег");
                    GivePlayerMoney(playerid, -count_cen_1);
                    pHackInfo[playerid][pFlesh] = 1;
                    return SendClientMessage(playerid, -1, "Вы купили флешку");
                }
                case 1:
                {
                    if(pHackInfo[playerid][pProvod] == 1) return SendClientMessage(playerid, -1, "У вас уже имеется провод");
                    if(GetPlayerMoney(playerid) < count_cen_2) return SendClientMessage(playerid, -1, "Недостаточно денег");
                    GivePlayerMoney(playerid, -count_cen_2);
                    pHackInfo[playerid][pProvod] = 1;
                    return SendClientMessage(playerid, -1, "Вы купили провод");
                }
            }
        }
    }  

 

Спойлер

#include "../Source/hack_car_td_players.inc"
ClearDate(playerid);  

 

Спойлер

    if(pHackInfo[playerid][pHacked] == 1)
    {
        SendClientMessage(playerid, -1, "Вы не смогли взломать машину и вас ударило током");
        pHackInfo[playerid][pHacked] = 0;
        PlayerTextDrawLetterSize(playerid, h_box_update[playerid], 0.000000, -0.705555);
        PlayerTextDrawHide(playerid, h_box_update[playerid]);
        PlayerTextDrawHide(playerid, h_text_update[playerid]);
        PlayerTextDrawHide(playerid, h_time_update[playerid]);




        for(new i = 0; i < 8; i ++) { TextDrawHideForPlayer(playerid, h_static_box[i]); }
        for(new i = 0; i < 6; i ++) { TextDrawHideForPlayer(playerid, h_text[i]); }
        ClearDate(playerid);
        return RemovePlayerFromVehicle(playerid);
    }  

 

Спойлер

#include "../Source/hack_car_td_static.inc"
CreateActor(5, a_x, a_y, a_z, a_angle);// Актер
Create3DTextLabel( "Продавец.\nНажмите Y", 0x008080FF, a_x, a_y, a_z, 40.0, 0 );  

 

Спойлер

stock h_veh(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay=-1)
{
    h_vehicle[h_vehicle_count] = AddStaticVehicleEx(modelid, x, y, z, angle, color1, color2, respawn_delay + 600);
    hacked_vehicle[h_vehicle_count] = 0;
    h_vehicle_count ++;
    return h_vehicle[h_vehicle_count];
}  

 

Спойлер

    new newcar = GetPlayerVehicleID(playerid);
    new Float:hp; GetPlayerHealth(playerid, hp);
    for(new b; b < h_vehicle_count; b ++)
    {
        if(newcar == h_vehicle[b] && hp > 0 && hacked_vehicle[b] == 0)
        {
            new _str[3][30]; new string_static[70 - 2 - 2 - 2 + 10 + 11 + 7 + 50];
            if(pHackInfo[playerid][pProvod] == 1) {_str[0] = "{53BE57}Имеется{FFFFFF}";} else {_str[0] = "{C9435E}Не имеется{FFFFFF}";}
            if(pHackInfo[playerid][pFlesh] == 1){_str[1] = "{53BE57}Имеется{FFFFFF}";}else{_str[1] = "{C9435E}Не имеется{FFFFFF}";}
            if(pHackInfo[playerid][pFlesh] == 1 && pHackInfo[playerid][pProvod] == 1) {_str[2] = "{53BE57}Возможно{FFFFFF}"; pHackInfo[playerid][pStatus] = 1;} else {_str[2] = "{C9435E}Не возможно{FFFFFF}"; pHackInfo[playerid][pStatus] = 0;}
            format(string_static, sizeof(string_static), "{FFFFFF}Информация о взломе машины:\nПровод: %s\nФлешка: %s\nСтатус взлома: %s",_str[0],_str[1],_str[2]);
            ShowPlayerDialog(playerid, d_hack_car, DIALOG_STYLE_MSGBOX,"Взлом машины", string_static, "Взломать","Отмена");
            break;
        }
    }  

 

Спойлер

    if(newkeys == KEY_YES)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, a_x, a_y, a_z))
        {
            new string[62 + 22];
            format(string, sizeof(string),"Название\tЦена\n\
            Флешка с вирусами\t[%d $]\n\
            Провода\t[%d $]", count_cen_1,count_cen_2);
            ShowPlayerDialog(playerid, d_buy_hack, DIALOG_STYLE_TABLIST_HEADERS, "Покупка техники", string, "Купить","Отмена");
        }
        // pKeyHack == 1 (Y) pKeyHack == 0 (N)
        if(pHackInfo[playerid][pHacked] == 1)
        {
            if(pHackInfo[playerid][pKeyHack] == 1)
            {
                pHackInfo[playerid][pCountHacked] += 1;
                switch(pHackInfo[playerid][pCountHacked])
                {
                    case 3: TextDrawShowForPlayer(playerid, h_text[0]);
                    case 6: TextDrawShowForPlayer(playerid, h_text[1]);
                    case 9: TextDrawShowForPlayer(playerid, h_text[2]);
                    case 11: TextDrawShowForPlayer(playerid, h_text[3]);
                    case 14: TextDrawShowForPlayer(playerid, h_text[4]);
                    case 19: TextDrawShowForPlayer(playerid, h_text[5]), Finish_Hack(playerid);
                }
                update_box_hack(playerid);
            }
            if(pHackInfo[playerid][pKeyHack] == 0 )
            {
                minus_health(playerid);
            }
            switch(random(2)) { case 0: pHackInfo[playerid][pKeyHack] = 0; case 1: pHackInfo[playerid][pKeyHack] = 1; }
            switch(pHackInfo[playerid][pKeyHack])
            {
                case 0: PlayerTextDrawSetString(playerid, h_text_update[playerid], "PRESS: N");
                case 1: PlayerTextDrawSetString(playerid, h_text_update[playerid], "PRESS: Y");
            }
            PlayerTextDrawShow(playerid, h_text_update[playerid]);
        }
    }
    if(newkeys == KEY_NO)
    {
        if(pHackInfo[playerid][pHacked] == 1)
        {
            if(pHackInfo[playerid][pKeyHack] == 0)
            {
                pHackInfo[playerid][pCountHacked] += 1;
                switch(pHackInfo[playerid][pCountHacked])
                {
                    case 3: TextDrawShowForPlayer(playerid, h_text[0]);
                    case 6: TextDrawShowForPlayer(playerid, h_text[1]);
                    case 9: TextDrawShowForPlayer(playerid, h_text[2]);
                    case 11: TextDrawShowForPlayer(playerid, h_text[3]);
                    case 14: TextDrawShowForPlayer(playerid, h_text[4]);
                    case 19: TextDrawShowForPlayer(playerid, h_text[5]), Finish_Hack(playerid);
                }
                update_box_hack(playerid);
            }
            if(pHackInfo[playerid][pKeyHack] == 1)
            {
                minus_health(playerid);
            }
            switch(random(2)) { case 0: pHackInfo[playerid][pKeyHack] = 0; case 1: pHackInfo[playerid][pKeyHack] = 1; }
            switch(pHackInfo[playerid][pKeyHack])
            {
                case 0: PlayerTextDrawSetString(playerid, h_text_update[playerid], "PRESS: N");
                case 1: PlayerTextDrawSetString(playerid, h_text_update[playerid], "PRESS: Y");
            }
            PlayerTextDrawShow(playerid, h_text_update[playerid]);
        }
    }  

 

Спойлер

stock Finish_Hack(playerid)
{
    pHackInfo[playerid][pHacked] = 0;
    SendClientMessage(playerid, -1, "Машина успешно взломана\n Скрываем комьютер...");
    SetTimerEx("@_Hide_H_Draws",2000,false,"i",playerid);
    new newcar = GetPlayerVehicleID(playerid);
    for(new b = 1; b < h_vehicle_count; b ++)
    {
        if(newcar == b)
        {
            hacked_vehicle[newcar-1] = 1;
            break;
        }
    }
    ClearDate(playerid);
    return true;
}  

 

Спойлер

@_Hide_H_Draws(playerid);
@_Hide_H_Draws(playerid)
{
    PlayerTextDrawHide(playerid, h_box_update[playerid]);
    PlayerTextDrawHide(playerid, h_text_update[playerid]);
    PlayerTextDrawHide(playerid, h_time_update[playerid]);




    for(new i = 0; i < 8; i ++) { TextDrawHideForPlayer(playerid, h_static_box[i]); }
    for(new i = 0; i < 6; i ++) { TextDrawHideForPlayer(playerid, h_text[i]); }
    
    TogglePlayerControllable(playerid, true);
    
    pHackInfo[playerid][pCountHacked] = 0;
}  

 

Спойлер

stock update_box_hack(playerid)
{
    new Float:si = size[playerid] - minus_size[playerid];
    size[playerid] = si;
    PlayerTextDrawLetterSize(playerid, h_box_update[playerid], 0.000000, si);
    PlayerTextDrawShow(playerid, h_box_update[playerid]);
    return true;
}  

 

Спойлер

stock minus_health(playerid)
{
    new Float:hp; GetPlayerHealth(playerid, hp);
    new Float:m_hp = hp - 10;
    SetPlayerHealth(playerid, m_hp);
}  

 

Спойлер

@_Minus_Count(playerid);
@_Minus_Count(playerid)
{
    if(pHackInfo[playerid][pCountHacked] != 0)
    {
        pHackInfo[playerid][pCountHacked] -= 1;
        new Float:si = size[playerid] + minus_size[playerid];
        size[playerid] = si;
        PlayerTextDrawLetterSize(playerid, h_box_update[playerid], 0.000000, si);
        PlayerTextDrawShow(playerid, h_box_update[playerid]);
    }
    switch(timer_check[playerid])
    {
        case 60..100:
        {
            SendClientMessage(playerid, -1, "Вы не смогли взломать машину и вас ударило током");
            PlayerTextDrawHide(playerid, h_box_update[playerid]);
            PlayerTextDrawHide(playerid, h_text_update[playerid]);
            PlayerTextDrawHide(playerid, h_time_update[playerid]);
            for(new i = 0; i < 8; i ++) { TextDrawHideForPlayer(playerid, h_static_box[i]); }
            for(new i = 0; i < 6; i ++) { TextDrawHideForPlayer(playerid, h_text[i]); }
            RemovePlayerFromVehicle(playerid);
            ClearDate(playerid);
            return true;
        }
    }
    timer_check[playerid] ++;
    
    new count = timer_cell[playerid] - minus_timer[playerid];
    timer_cell[playerid] = count;
        
    new _str[13];
    format(_str, sizeof(_str), "TIME: %d",count);
    PlayerTextDrawSetString(playerid, h_time_update[playerid], _str);
    PlayerTextDrawShow(playerid,h_time_update[playerid]);
    return true;
}  

 

Спойлер

stock ClearDate(playerid)
{
    PlayerTextDrawLetterSize(playerid, h_box_update[playerid], 0.000000, -0.705555); // Восстанавливаем высоту бокса
    size[playerid] = -0.705555;

    KillTimer(timer_minus_count[playerid]);
    timer_check[playerid] = 0;
    minus_timer[playerid] = 1;
    timer_cell[playerid] = 60;
    
    pHackInfo[playerid][pProvod] = 0;
    pHackInfo[playerid][pFlesh] = 0;
    pHackInfo[playerid][pStatus] = 0;
    pHackInfo[playerid][pHacked] = 0;
    pHackInfo[playerid][pCountHacked] = 0;
    pHackInfo[playerid][pKeyHack] = 0;
} 

 

 

Полезная информация:

Кастомная функция h_veh 

Параметры: modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay=-1

Как использовать?

- Допустим вам надо создать простую машину без системы взлома - Используем CreateVehicle или AddStaticVehicle
- Если нужно создать машину с системой взлома - Используем h_veh

Пример:

- 
CreateVehicle(403, 2035.8324, 1332.5811, 11.3482, 0.0000, -1, -1, 100); - Создаст кар без взлома
- h_veh(403, 2051.5430, 1349.5922, 10.8316, 0.0000, -1, -1, 100); - создаст кар со взломом

Где можно использовать:

Допустим у вас стандартный скриллакс мод, то эту систему можно использовать для гос фракций, типа:

lspd_car = h_veh(403, 2051.5430, 1349.5922, 10.8316, 0.0000, -1, -1, 100);
 

Автор: Salery

Использующиеся инклуды.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • MetaLife Online
      By MetaLife Online
      Привествую! писал код. проверил работу, в БД отправилось информация криво 
      потом добавил к P_NICK[MAX_PLAYER_NAME] для того чтобы все было окей. Но после этого данные вообще не отпровляються и не показываеться %s. пару раз удалял и не помогло не чего 
      enum PLAYER_INFO {     P_ID,     P_NICK[MAX_PLAYER_NAME],     P_PASS,     P_GENDER,     P_SKIN,     P_LVL, };  

    • Danny_Marcelo
      By Danny_Marcelo
      Всех приветствую. Сегодня я решил обновить систему мероприятий, т.к. на самом проекте Advance RP уже давно видоизменили систему, добавили нового функционала. Мы не должны стоять на месте и я решил тоже свою систему доработать. Вы можете использовать данную систему как аналог Advance RP или же доработать для своего проекта. Все в ваших руках как говорится.
       
      Что нового?
       
      Итак приступим:
      Находим свои переменные и вставляем:
       
      new settp = 0; // Флаг включения/выключения телепортации new Float:TeleportFloat[3]; // Координаты точки телепортации new TeleportInfo[2]; // Интерьер и виртуальный мир new Float:PlayerLastPos[MAX_PLAYERS][3]; // Последние координаты игрока new PlayerLastInt[MAX_PLAYERS]; // Последний интерьер игрока new PlayerLastVW[MAX_PLAYERS]; // Последний виртуальный мир игрока new PlayerWeapons[MAX_PLAYERS][13][2]; // Оружие игрока (слот и патроны) new PlayerUsedTP[MAX_PLAYERS]; // Флаг для отслеживания использования /tp  
      Далее идём в команды, мой случай на Pawn.CMD, но +/- везде одинаково, разве что меняется шапка
       
      CMD:settp(playerid, params[]) {     if (PlayerInfo[playerid][pAdmin] < 4) return 1;     new string[95];     if (settp == 0)     {         GetPlayerPos(playerid, TeleportFloat[0], TeleportFloat[1], TeleportFloat[2]);         TeleportInfo[0] = GetPlayerInterior(playerid);         TeleportInfo[1] = GetPlayerVirtualWorld(playerid);         settp = 1;         format(string, sizeof(string), "[A] %s[%d] установил точку телепорта для игроков. {00CC00}ТП включен.", PlayerInfo[playerid][pName], playerid);         SendAdminMessage(0x52B2B5FF, string);     }     else     {         format(string, sizeof(string), "[A] %s[%d] удалил точку телепорта для игроков. {FF6600}ТП отключен.", PlayerInfo[playerid][pName], playerid);         SendAdminMessage(0x52B2B5FF, string);         settp = 0;     }     return 1; } CMD:tp(playerid, params[]) {     if (settp == 0) return SendClientMessage(playerid, 0xCECECEFF, !"Функция отключена администратором.");     if (PlayerInfo[playerid][pJailed] >= 1) return SendClientMessage(playerid, 0xCECECEFF, !"Арестованным не разрешено покидать камеру.");     if (PlayerInfo[playerid][pRabota] != 0) return SendClientMessage(playerid, 0xCECECEFF, !"Необходимо завершить все начатые работы и активные действия.");     if (bolkam[playerid] == true) return SendClientMessage(playerid, 0xCECECEFF, !"Необходимо завершить все начатые работы и активные действия.");     GetPlayerPos(playerid, PlayerLastPos[playerid][0], PlayerLastPos[playerid][1], PlayerLastPos[playerid][2]);     PlayerLastInt[playerid] = GetPlayerInterior(playerid);     PlayerLastVW[playerid] = GetPlayerVirtualWorld(playerid);     for (new i = 0; i < 13; i++)     {         GetPlayerWeaponData(playerid, i, PlayerWeapons[playerid][i][0], PlayerWeapons[playerid][i][1]);     }     PlayerUsedTP[playerid] = 1;     ShowPlayerDialog(playerid, 22, DIALOG_STYLE_MSGBOX, !"{6699FF}Телепортация",         !"{FFFFFF}Вы уверены, что хотите попасть на место проведения мероприятия?\n{FFCD00}Ваше оружие будет изъято для хранения и возвращено позже.", !"Да", !"Нет");     return 1; }  
       
      CMD:back(playerid, params[]) {     if (!PlayerUsedTP[playerid])     {         return SendClientMessage(playerid, 0xCECECEFF, !"Эту функцию можно использовать после {FF9933}/tp, /go {CECECE}или по окончании {FF9933}мероприятий");     }     SetPlayerPos(playerid, PlayerLastPos[playerid][0], PlayerLastPos[playerid][1], PlayerLastPos[playerid][2]);     SetPlayerInterior(playerid, PlayerLastInt[playerid]);     SetPlayerVirtualWorld(playerid, PlayerLastVW[playerid]);     ResetPlayerWeapons(playerid);     for (new i = 0; i < 13; i++)     {         if (PlayerWeapons[playerid][i][0] != 0)         {             GivePlayerWeapon(playerid, PlayerWeapons[playerid][i][0], PlayerWeapons[playerid][i][1]);         }     }     PlayerUsedTP[playerid] = 0;     SendClientMessage(playerid, 0x3399FFFF, !"Вы вернулись туда, где были до телепортации");     return 1; } Ну и в OnDialogResponse:
      case 22: // Не забудьте проверить и при надобности изменить id диалога на вашу цифру или ID_NAME         {             if (response)             {                 SetPlayerPos(playerid, TeleportFloat[0], TeleportFloat[1], TeleportFloat[2]);                 SetPlayerInterior(playerid, TeleportInfo[0]);                 SetPlayerVirtualWorld(playerid, TeleportInfo[1]);                 ResetPlayerWeapons(playerid);                 SendClientMessage(playerid, 0x66CCFFFF, "Вы были доставлены на место проведения мероприятия");                 SendClientMessage(playerid, 0x66CCFFFF, "Чтобы вернуться обратно, введите {FF9900}/back");             }         } Скриншоты:
       
      Если игрок сидит в КПЗ и вводит /tp:

       
      При включенном /tp:

       
      При выключенном /tp:

       
      Сообщение администраторам:

       
      Если работаешь или лечишься в больнице:

       
      Текст после телепортации:

       
      При вводе /back 1 и более раз:

       
      P.S. Команду /tp на Advance можно нажимать бесконечно, по этому я не стал сюда пихать аналогичную проверку как в /back.
      Если что, не сложно будет добавить 1 строчку проверки. Просто имейте ввиду, что это не баг. Просто нужно же соответствовать названию темы "На 100% КОПИЯ"))
       
      Автор: Danny_Marcelo
      Размещая на другие порталы, обязательно указать автора