Ребята если есть предложения по развитию форума
Пишите вк группу https://vk.com/gszone или сюда https://vk.com/evg_ice будем очень рады выслушать вашу идею!

Система кейсов

Здесь вы можете опубликуйте свои учебники.
Ответить
Аватара пользователя
SiReX
Moderator
Moderator
Сообщения: 104
Зарегистрирован: 03 апр 2018 21:02
Настроение:
Контактная информация:
Ukraine

Система кейсов

Сообщение SiReX » 04 апр 2018 17:49



Создаём две переменных.
PHP код:

Код: Выделить всё

new PlayerText:Rulletca[MAX_PLAYERS][9];
new Case[5];  
Далее в OnPlayerConnect кидаем наш TextDraw

Код: Выделить всё

Rulletca[playerid][0] = CreatePlayerTextDraw(playerid, 202.666625, 233.381469, "usebox");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][0], 0.000000, 7.459465);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][0], 26.333332, 0.000000);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][0], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][0], 0);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][0], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][0], 421075455);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][0], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][0], 0);
    PlayerTextDrawFont(playerid, Rulletca[playerid][0], 0);

    Rulletca[playerid][1] = CreatePlayerTextDraw(playerid, 96.666664, 228.148147, "New Textdraw");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][1], 0.449999, 1.600000);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][1], 35.000003, 29.451864);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][1], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][1], 8388863);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][1], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][1], 268435455);
    PlayerTextDrawBackgroundColor(playerid, Rulletca[playerid][1], -256);
    PlayerTextDrawFont(playerid,Rulletca[playerid][1],TEXT_DRAW_FONT_MODEL_PREVIEW);
    PlayerTextDrawSetPreviewModel(playerid,Rulletca[playerid][1], 19134);
    PlayerTextDrawSetPreviewRot(playerid,Rulletca[playerid][1], 180.000000, 0.000000, 90.000000);

    Rulletca[playerid][2] = CreatePlayerTextDraw(playerid, 202.666671, 295.359252, "usebox");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][2], 0.000000, 0.326133);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][2], 26.333332, 0.000000);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][2], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][2], 0);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][2], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][2], -1523963137);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][2], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][2], 0);
    PlayerTextDrawFont(playerid, Rulletca[playerid][2], 0);

    Rulletca[playerid][3] = CreatePlayerTextDraw(playerid, 99.000045, 255.940734, "New Textdraw");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][3], 0.449999, 1.600000);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][3], 30.333330, 35.259277);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][3], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][3], 8388863);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][3], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][3], 0);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][3], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][3], 1);
    PlayerTextDrawBackgroundColor(playerid, Rulletca[playerid][3], 51);
    PlayerTextDrawFont(playerid, Rulletca[playerid][3], 5);
    PlayerTextDrawSetProportional(playerid, Rulletca[playerid][3], 1);

    Rulletca[playerid][4] = CreatePlayerTextDraw(playerid, 65.000030, 255.696304, "New Textdraw");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][4], 0.449999, 1.600000);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][4], 30.333330, 35.259277);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][4], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][4], -1);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][4], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][4], 0);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][4], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][4], 1);
    PlayerTextDrawBackgroundColor(playerid, Rulletca[playerid][4], 51);
    PlayerTextDrawFont(playerid, Rulletca[playerid][4], 5);
    PlayerTextDrawSetProportional(playerid, Rulletca[playerid][4], 1);

    Rulletca[playerid][5] = CreatePlayerTextDraw(playerid, 133.000030, 255.866638, "New Textdraw");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][5], 0.449999, 1.600000);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][5], 30.333330, 35.259277);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][5], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][5], -1);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][5], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][5], 0);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][5], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][5], 1);
    PlayerTextDrawBackgroundColor(playerid, Rulletca[playerid][5], 51);
    PlayerTextDrawFont(playerid, Rulletca[playerid][5], 5);
    PlayerTextDrawSetProportional(playerid, Rulletca[playerid][5], 1);


    Rulletca[playerid][6] = CreatePlayerTextDraw(playerid, 31.000030, 255.622192, "New Textdraw");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][6], 0.449999, 1.600000);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][6], 30.333330, 35.259277);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][6], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][6], -1);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][6], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][6], 0);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][6], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][6], 1);
    PlayerTextDrawBackgroundColor(playerid, Rulletca[playerid][6], 51);
    PlayerTextDrawFont(playerid, Rulletca[playerid][6], 5);
    PlayerTextDrawSetProportional(playerid, Rulletca[playerid][6], 1);


    Rulletca[playerid][7] = CreatePlayerTextDraw(playerid, 167.333389, 255.377716, "New Textdraw");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][7], 0.449999, 1.600000);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][7], 30.333330, 35.259277);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][7], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][7], -1);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][7], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][7], 0);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][7], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][7], 1);
    PlayerTextDrawBackgroundColor(playerid, Rulletca[playerid][7], 51);
    PlayerTextDrawFont(playerid, Rulletca[playerid][7], 5);
    PlayerTextDrawSetProportional(playerid, Rulletca[playerid][7], 1);
    

    Rulletca[playerid][8] = CreatePlayerTextDraw(playerid, 103.000038, 292.859222, "ctapt");
    PlayerTextDrawLetterSize(playerid, Rulletca[playerid][8], 0.205666, 0.770370);
    PlayerTextDrawTextSize(playerid, Rulletca[playerid][8], 127.333343, 8.296295);
    PlayerTextDrawAlignment(playerid, Rulletca[playerid][8], 1);
    PlayerTextDrawColor(playerid, Rulletca[playerid][8], -1);
    PlayerTextDrawUseBox(playerid, Rulletca[playerid][8], true);
    PlayerTextDrawBoxColor(playerid, Rulletca[playerid][8], 572661504);
    PlayerTextDrawSetShadow(playerid, Rulletca[playerid][8], 0);
    PlayerTextDrawSetOutline(playerid, Rulletca[playerid][8], 0);
    PlayerTextDrawBackgroundColor(playerid, Rulletca[playerid][8], 51);
    PlayerTextDrawFont(playerid, Rulletca[playerid][8], 2);
    PlayerTextDrawSetProportional(playerid, Rulletca[playerid][8], 1);
    PlayerTextDrawSetSelectable(playerid, Rulletca[playerid][8], true); 
Далее в команды добавляем
PHP код:

Код: Выделить всё

CMD:cs1(playerid)
{
    if(GetPVarInt(playerid, " OpenCase " ) )
        return 1;

    PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][3], 1275);
    Case[0] = 1275;

    PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][4], 1274);
    Case[1] = 1274;

    PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][5], 1239);
    Case[2] = 1239;

    PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][6], 292);
    Case[3] = 292;

    PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][7], 299);
    Case[4] = 299;

    for(new i = 0; i<= 8; i++)
        PlayerTextDrawShow(playerid,Rulletca[playerid][i]);

    SelectTextDraw(playerid, 0xFFFFFF22);

    TogglePlayerControllable(playerid, 0);

    return true;
}
CMD:cs2(playerid)
{
    for(new i = 0; i<= 8; i++)
        PlayerTextDrawHide(playerid,Rulletca[playerid][i]);

    DeletePVar(playerid, " OCK " ) ;

    DeletePVar(playerid," OpenCase " ) ;

    TogglePlayerControllable(playerid, 1);

    CancelSelectTextDraw(playerid);

    return true;
}  
В OnPlayerClickPlayerTextDraw
PHP код:

Код: Выделить всё

if(playertextid == Rulletca[playerid][8])
    {
        new time = SetTimerEx( " @_openCase " , 100 , true , " i " , playerid ) ;

        SetPVarInt(playerid,! " OCTimer " , time ) ;

        SetPVarInt(playerid, ! " OpenCase " , 1 ) ;

        SetPVarInt(playerid, ! " OCK " , random ( 50 - 20 ) + 20 ) ;

        TogglePlayerControllable(playerid, 0);

        Sen
И в конец мода кидаем наш паблик
PHP код:

Код: Выделить всё

@_openCase(playerid);
@_openCase(playerid)
{
    if(GetPVarInt(playerid, ! " OCK " ) > 1 )
    {
        Case[4] = Case[3];
        PlayerTextDrawHide(playerid,Rulletca[playerid][7]);
        PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][7], Case[4]);
        PlayerTextDrawShow(playerid,Rulletca[playerid][7]);

        Case[3] = Case[2];
        PlayerTextDrawHide(playerid,Rulletca[playerid][6]);
        PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][6], Case[3]);
        PlayerTextDrawShow(playerid,Rulletca[playerid][6]);

        Case[2] = Case[1];
        PlayerTextDrawHide(playerid,Rulletca[playerid][5]);
        PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][5], Case[2]);
        PlayerTextDrawShow(playerid,Rulletca[playerid][5]);

        Case[1] = Case[0];
        PlayerTextDrawHide(playerid,Rulletca[playerid][4]);
        PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][4], Case[1]);
        PlayerTextDrawShow(playerid,Rulletca[playerid][4]);

        switch(random(46))
        {
            case  0 .. 10:  Case [0] = 1212; // бабки
            case 11 .. 14:  Case [0] = 1274; // донат
            case 15 .. 16:  Case [0] = 230; // cкин
            case 17 .. 18:  Case [0] = 292; // cкин
            case 19 .. 26:  Case [0] = 80; // cкин
            case 27 .. 30:  Case [0] = 149; // cкин
            case 31 .. 36:  Case [0] = 291; // cкин
            case 37 .. 41:  Case [0] = 293; // cкин
            case 42 .. 46:  Case [0] = 299; // cкин
        }
        PlayerTextDrawHide(playerid,Rulletca[playerid][3]);
        PlayerTextDrawSetPreviewModel(playerid, Rulletca[playerid][3], Case[3]);
        PlayerTextDrawShow(playerid,Rulletca[playerid][3]);
        SetPVarInt(playerid, ! " OCK " , GetPVarInt(playerid, ! " OCK " ) - 1 ) ;
    }
    else
    {
        switch(Case[3])
        {
            case 1212: // деньги
            {
                new money;
                switch(random(55))
                {
                    case  0 .. 10 ,20 .. 30 , 46 .. 55: money = 40000;
                    case 11 .. 19: money = 60000;
                    case 31 .. 36: money = 10000;
                    case 37 .. 40: money = 15000;
                    case 41 .. 43: money = 20000;
                    case 44 .. 45: money = 40000;
                }

                static const
                    moneys [] = "~G~You Won $%d MONEY";
                new str_money[sizeof(moneys) + 10 - 2];

                format(str_money,sizeof(str_money),moneys ,money);

                GameTextForPlayer(playerid, str_money, 200, 1);
            }
            case 1274:
            {
                new money;
                switch(random(10))
                {
                    case 0 .. 4: money = 60;
                    case 5 .. 8: money = 65;
                    case 9 .. 10: money = 70;
                }
                static const
                    donate [] = "G~You Won %d DONATE";
                new str_donate[sizeof(donate) + 10 - 2];

                format(str_donate,sizeof(str_donate),donate ,money);

                GameTextForPlayer(playerid, str_donate, 200, 1);
            }
            case 230: PlayerInfo[playerid][pSkin] = 230;
            case 292: PlayerInfo[playerid][pSkin] = 292;
            case 80:  PlayerInfo[playerid][pSkin] = 80;
            case 149: PlayerInfo[playerid][pSkin] = 149;
            case 291: PlayerInfo[playerid][pSkin] = 291;
            case 293: PlayerInfo[playerid][pSkin] = 293;
            case 299: PlayerInfo[playerid][pSkin] = 299;
            case 1239:
            {
                   PlayerInfo[playerid][pExp] += 1;
                static const
                    exp [] = "+1EXP";
                new str_exp[sizeof(exp)];

                format(str_exp,sizeof(str_exp),exp);

                GameTextForPlayer(playerid, str_exp, 200, 1);
            }
        }
        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
        KillTimer(GetPVarInt(playerid, ! " OCTimer " ) ) ;
        DeletePVar(playerid, ! " OCTimer " ) ;
    }
    return 1;
} 

Ответить

Вернуться в «GTA San Andreas Multiplayer Уроки»