• Страница 1 из 1
  • 1
[Мануал] Выбор скина на TextDraw'e
Hammer3394Дата: Понедельник, 20.01.2014, 17:20 | Сообщение # 1
Рядовой
Группа: Администраторы
Сообщений: 13
Репутация: 2013
Статус: Offline
Здравствуйте ув.пользователи Pawno-Schooli!
Собственно приступим!

Создадим наш пикап:

Код
new Text:ButtonLeft;
new Text:ButtonRight;
new Text:ButtonSelect;
new ClothesRound[MAX_PLAYERS];
new SelectCharRegID[MAX_PLAYERS];


В GameModeInit:

Код
LoadTextDraws();


В public OnPlayerSpawn(playerid)

Код
{
                SetPlayerVirtualWorld(playerid, playerid);
                SetPlayerInterior(playerid,0);
                SetPlayerPos(playerid,1526.03,-1346.4008,330.0234);
                SetPlayerFacingAngle(playerid,63.8611);
                SetPlayerCameraPos(playerid,1520.0631,-1343.1326,330.6207);
                SetPlayerCameraLookAt(playerid,1526.0348,-1346.2710,330.0553);
                TogglePlayerControllable(playerid, 0);
                TextDrawShowForPlayer(playerid,ButtonLeft);
                TextDrawShowForPlayer(playerid,ButtonRight);
            TextDrawShowForPlayer(playerid,ButtonSelect);
            SelectTextDraw(playerid, 0xFF4040AA);
            if(Player [playerid][pSex]== 1) SetPlayerSkin(playerid, 78), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 78;
            else SetPlayerSkin(playerid, 12), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 12;
        }


В конец мода:

Код
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
        if(ClothesRound [playerid]== 1)
        {
            if(clickedid == ButtonRight)
            {
                 if(PlayerInfo [playerid][pSex]== 1)
                {
                    switch(SelectCharRegID[playerid])
                    {
                        case 1: SetPlayerSkin(playerid, 79), SelectCharRegID [playerid]= 2, ChosenSkin [playerid]= 79;
                        case 2: SetPlayerSkin(playerid, 135), SelectCharRegID [playerid]= 3, ChosenSkin [playerid]= 135;
                        case 3: SetPlayerSkin(playerid, 230), SelectCharRegID [playerid]= 4, ChosenSkin [playerid]= 230;
                        case 4: SetPlayerSkin(playerid, 137), SelectCharRegID [playerid]= 5, ChosenSkin [playerid]= 137;
                        case 5: SetPlayerSkin(playerid, 200), SelectCharRegID [playerid]= 6,ChosenSkin [playerid]= 200;
                        case 6: SetPlayerSkin(playerid, 78), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 78;
                    }
                }
                  else
                 {
                     switch(SelectCharRegID[playerid])
                    {
                        case 1: SetPlayerSkin(playerid, 13), SelectCharRegID [playerid]= 2, ChosenSkin [playerid]= 13;
                        case 2: SetPlayerSkin(playerid, 55), SelectCharRegID [playerid]= 3, ChosenSkin [playerid]= 55;
                        case 3: SetPlayerSkin(playerid, 90), SelectCharRegID [playerid]= 4, ChosenSkin [playerid]= 90;
                        case 4: SetPlayerSkin(playerid, 193), SelectCharRegID [playerid]= 5, ChosenSkin [playerid]= 193;
                        case 5: SetPlayerSkin(playerid, 12), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 12;
                       }
                 }
            }
            else if(clickedid == ButtonLeft)
            {
                 if(Player [playerid][pSex]== 1)
                {
                    switch(SelectCharRegID[playerid])
                    {
                        case 1: SetPlayerSkin(playerid, 200), SelectCharRegID [playerid]= 6, ChosenSkin [playerid]= 200;
                        case 6: SetPlayerSkin(playerid, 137), SelectCharRegID [playerid]= 5, ChosenSkin [playerid]= 137;
                        case 5: SetPlayerSkin(playerid, 230), SelectCharRegID [playerid]= 4, ChosenSkin [playerid]= 230;
                        case 4: SetPlayerSkin(playerid, 135), SelectCharRegID [playerid]= 3, ChosenSkin [playerid]= 135;
                        case 3: SetPlayerSkin(playerid, 79), SelectCharRegID [playerid]= 2, ChosenSkin [playerid]= 79;
                        case 2: SetPlayerSkin(playerid, 78), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 78;
                      }
                }
                  else
                 {
                     switch(SelectCharRegID[playerid])
                    {
                        case 1: SetPlayerSkin(playerid, 193), SelectCharRegID [playerid]= 5, ChosenSkin [playerid]= 193;
                        case 5: SetPlayerSkin(playerid, 90), SelectCharRegID [playerid]= 4, ChosenSkin [playerid]= 90;
                        case 4: SetPlayerSkin(playerid, 55), SelectCharRegID [playerid]= 3, ChosenSkin [playerid]= 55;
                        case 3: SetPlayerSkin(playerid, 13), SelectCharRegID [playerid]= 2, ChosenSkin [playerid]= 13;
                        case 2: SetPlayerSkin(playerid, 12), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 12;
                       }
                }
            }
            else if(clickedid == ButtonSelect)
            {
                   PlayerInfo [playerid][pModel]= ChosenSkin[playerid];
                SelectCharRegID [playerid]= 0;
                ClothesRound [playerid]= 0;
                TogglePlayerControllable(playerid, 1);
                OnPlayerRegister(playerid,Player[playerid][pPassword]);
                 TextDrawHideForPlayer(playerid,ButtonLeft);
                TextDrawHideForPlayer(playerid,ButtonRight);
                TextDrawHideForPlayer(playerid,ButtonSelect);
                CancelSelectTextDraw(playerid);
                SetPlayerVirtualWorld(playerid,0);
                SendClientMessage(playerid,-1,"??????????? ?????? ???????");
                SetSpawnInfo(playerid, 255, Player[playerid][pModel], 0, 0, 0, 1.0, -1, -1, -1, -1, -1, -1);
                SpawnPlayer(playerid);
                PlayerInfo [playerid][pLevel]= 1;
                SetPlayerPos(playerid,-1967.6738,115.7038,27.6875);
                SetPlayerFacingAngle(playerid, 101.2675);
                SetPlayerInterior(playerid,0);
                SetPlayerVirtualWorld(playerid, 0);
                SetPlayerScore(playerid,1);
            }
            if(clickedid == Text:INVALID_TEXT_DRAW)
            {
                if(ClothesRound [playerid]== 1)
                {
                    TogglePlayerControllable(playerid, 0);
                    TextDrawShowForPlayer(playerid,ButtonLeft);
                    TextDrawShowForPlayer(playerid,ButtonRight);
                    TextDrawShowForPlayer(playerid,ButtonSelect);
                    SelectTextDraw(playerid, 0xFF4040AA);
                    if(PlayerInfo [playerid][pSex]== 1) SetPlayerSkin(playerid, 78), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 78;
                    else SetPlayerSkin(playerid, 12), SelectCharRegID [playerid]= 1, ChosenSkin [playerid]= 12;
                }
            }
        }
        return 1;
}

И вот это

Код
stock LoadTextDraws()
{
        ButtonLeft = TextDrawCreate(50.0, 200.0, "LD_BEAT:left");
        TextDrawFont(ButtonLeft, 4);
        TextDrawTextSize(ButtonLeft, 50, 25);
        TextDrawSetSelectable(ButtonLeft, 1);

        ButtonRight = TextDrawCreate(530.0, 200.0, "LD_BEAT:right");
        TextDrawFont(ButtonRight, 4);
        TextDrawTextSize(ButtonRight, 50, 25);
        TextDrawSetSelectable(ButtonRight, 1);

        ButtonSelect = TextDrawCreate(382.000000, 371.000000, "Select");
        TextDrawTextSize(ButtonSelect, 482.0, 22.0);
        TextDrawBackgroundColor(ButtonSelect, 255);
        TextDrawFont(ButtonSelect, 3);
        TextDrawLetterSize(ButtonSelect, 0.899999, 2.400000);
        TextDrawColor(ButtonSelect, 869072895);
        TextDrawSetOutline(ButtonSelect, 0);
        TextDrawSetProportional(ButtonSelect, 1);
        TextDrawSetShadow(ButtonSelect, 1);
        TextDrawSetSelectable(ButtonSelect, 1);
}

СПОЙЛЕР                                                                                                                                                                                              
 
  • Страница 1 из 1
  • 1
Поиск: