Доступ к готовым решениям

Переход в группу "Пользователь"

300.00
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Мануал Работа уборщика [2 версия]

faraday.

Эксперт
Регистрация
15 Окт 2015
Сообщения
1,667
Лучшие ответы
77
Репутация
1,008
Награды
1
Исправил все недочеты и улучшил код своей прошлой работы (2014 год)

Вы собираете мусор на пляже с пакетом, с каждым взятым объектом мусора - пакет в руке увеличивается, больше 15 мусорных объектов носить нельзя, нужно выкидывать в жбан, после чего опять собирать.
Объекты постоянно обновляются, все сопровождается удобным текстдравом

Cобирать мусор - клавиша ALT
Выкидывать в жбан - клавиша ALT


ко всем new:

PHP:
new pickup_trash_job,
    litter[30],
    trash = 30,
    Text:job_td[MAX_PLAYERS],
    Float:coord_obj[MAX_PLAYERS][2];
    
new Float:trash_object[30][3] = {
    {617.747741,-1877.806274,3.38381},
    {632.308471,-1880.004760,3.367703},
    {639.848632,-1856.302246,4.543799},
    {625.965576,-1880.298706,3.314722},
    {637.335144,-1870.778076,3.899995},
    {623.070373,-1861.995117,4.359910},
    {636.945617,-1860.985229,4.602905},
    {631.633911,-1872.288085,3.898286},
    {623.602172,-1874.981445,3.579676},
    {626.375732,-1870.782226,3.932815},
    {604.483581,-1879.646850,3.246384},
    {599.627502,-1861.806884,4.246555},
    {580.439880,-1861.407836,3.984007},
    {586.950317,-1869.291503,3.581429},
    {594.259765,-1870.975585,3.801309},
    {598.388122,-1877.198974,3.362951},
    {607.590087,-1863.304809,4.170703},
    {615.023803,-1858.458618,4.313018},
    {603.239807,-1885.194458,3.036873},
    {609.370849,-1887.010742,3.141731},
    {614.221862,-1885.502807,3.014095},
    {624.142395,-1888.274658,3.079805},
    {631.751037,-1888.015258,2.971426},
    {618.174560,-1894.566406,2.600891},
    {600.638427,-1894.585327,2.703701},
    {589.851562,-1889.585937,3.021248},
    {579.439392,-1882.567504,3.154924},
    {575.060424,-1871.364990,3.549407},
    {586.512451,-1849.734375,4.585798},
    {591.037780,-1858.562866,4.073434}
};
public OnPlayerConnect:

PHP:
     job_td[playerid] = TextDrawCreate(12.181549, 223.999908, "Mycop: 0~n~$: 0");
     TextDrawLetterSize(job_td[playerid], 0.449999, 1.600000);
     TextDrawAlignment(job_td[playerid], 1);
     TextDrawColor(job_td[playerid], 0xCECFCEFF);
     TextDrawSetShadow(job_td[playerid], 0);
     TextDrawSetOutline(job_td[playerid], 1);
     TextDrawBackgroundColor(job_td[playerid], 51);
     TextDrawFont(job_td[playerid], 3);
     TextDrawSetProportional(job_td[playerid], 1);
public OnDialogResponse:

PHP:
case 23://if(dialogid == 23)
    {
        if(response)
        {
            if(GetPVarInt(playerid, "beach") == 0)
            {
                SetPVarInt(playerid, "beach",1);
                SetPVarInt(playerid, "pack",0);
                SetPVarInt(playerid, "skin_old", GetPlayerSkin(playerid));
                SetPlayerSkin(playerid, 16);
                TextDrawShowForPlayer(playerid,job_td[playerid]);
                new string[50];
                format(string,sizeof(string),"Mycop: %d~n~$: %d",GetPVarInt(playerid, "trash"),GetPVarInt(playerid, "pack")*4);
                TextDrawSetString(job_td[playerid], string);
                SendClientMessage(playerid,0xCECFCEFF, "Рабочий день {63cb00}начат.");
                SetPlayerAttachedObject(playerid, 1, 1264, 6, 0.189000, -0.014000, 0.000000, 90.000000, -90.500000, 0.000000, 0.2,0.2, 0.2);
                coord_obj[playerid][0] = 0.2,coord_obj[playerid][1] = 0.2;
            }
            else
            {
                new string[64];
                if(GetPVarInt(playerid, "beach") == 0) return SendClientMessage(playerid, 0xCECFCEFF, "Ошибка! Вы еще не работаете уборщиком");
                GivePlayerMoney(playerid,GetPVarInt(playerid, "pack")*4);
                TextDrawHideForPlayer(playerid,job_td[playerid]);
                format(string,sizeof(string), "Вы заработали: {63cb00}%d$", GetPVarInt(playerid, "pack")*4);
                SendClientMessage(playerid, 0xCECFCEFF, string);
                RemovePlayerAttachedObject(playerid,1);
                SetPlayerSkin(playerid, GetPVarInt(playerid, "skin_old"));
                DeletePVar(playerid, "pack");
                DeletePVar(playerid, "beach");
                DeletePVar(playerid, "trash");
            }
        }
    }
в public OnPlayerPickUpPickup:

PHP:
if(pickupid == pickup_trash_job)
{
        if(GetPVarInt(playerid, "BEACH")) ShowPlayerDialog(playerid,23,0,"Уволиться с работы","Вы действительно хотите уволиться?","Да","Нет");
        else ShowPlayerDialog(playerid,23,0,"Устройство на работу","Вы действительно хотите устроиться?","Да","Нет");
}
в OnGameModeInit
PHP:
CreateObject(1334, 609.259338,-1876.764404,4.334559, 0.000000,0.000000,-179.699981);//жбан
	for(new h; h < 30; h++) litter[h] = CreateObject(2670,trash_object[h][0],trash_object[h][1],trash_object[h][2],0.000000,0.000000,0.000000); 
	pickup_trash_job = CreatePickup(1239, 2 ,611.4769,-1875.1583,5.7707,1.3658);
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys):

PHP:
if(newkeys == 1024 && GetPVarInt(playerid, "beach"))
{
        new string[50];
         for(new i; i < 30; i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 1.5,trash_object[i][0],trash_object[i][1],trash_object[i][2]) && litter[i] != 0)
            {
                if(GetPVarInt(playerid, "trash") == 15) return SendClientMessage(playerid, 0xCECFCEFF, "У вас полный мешок мусора. {63cb00}Выбросите его у мусорного бака (ALT)");
                ApplyAnimation(playerid, "MISC", "pickup_box", 4.0, 0, 0, 0, 0, -1);
                SetPVarInt(playerid, "pack",GetPVarInt(playerid,"pack") +1);
                SetPVarInt(playerid, "trash",GetPVarInt(playerid,"trash") +1);
                RemovePlayerAttachedObject(playerid,1);
                SetPlayerAttachedObject(playerid, 1, 1264, 6, 0.189000, -0.014000, 0.000000, 90.000000, -90.500000, 0.000000, coord_obj[playerid][0]+0.2,coord_obj[playerid][0]+0.02,coord_obj[playerid][1]+0.02);
                coord_obj[playerid][0]+= 0.02;
                coord_obj[playerid][1]+= 0.02;
                format(string,sizeof(string),"Mycop: %d~n~$: %d",GetPVarInt(playerid, "trash"),GetPVarInt(playerid, "pack")*4);
                TextDrawSetString(job_td[playerid], string);
                DestroyObject(litter[i]),litter[i] = 0;
                trash --;
                if(trash == 0)
                {
                    for(new h; h < 30; h++) litter[h] = CreateObject(2670,trash_object[h][0],trash_object[h][1],trash_object[h][2],0.000000,0.000000,0.000000);
                    trash = 30;
                }
                return 1;
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 1.5, 609.3203,-1877.8152,4.2218))
        {
            if(!GetPVarInt(playerid, "trash")) return SendClientMessage(playerid, 0xCECFCEFF, "У вас нет мусора");
            SetPVarInt(playerid, "trash",0);
            format(string,sizeof(string),"Mycop: %d~n~$: %d",GetPVarInt(playerid, "trash"),GetPVarInt(playerid, "pack")*4);
            TextDrawSetString(job_td[playerid], string);
            ApplyAnimation(playerid,"CARRY","crry_prtial",4.1,0,1,1,1,1);
            SetPlayerAttachedObject(playerid, 1, 1264, 6,0.189000, -0.014000, 0.000000, 90.000000, -90.500000, 0.000000, 0.2,0.2, 0.2);
            coord_obj[playerid][0] = 0.2,coord_obj[playerid][1] = 0.2;
            return 1;
        }
}



автор: unreal.
 
Последнее редактирование:
Сверху Снизу