Выбор скина на текстдравах

Уроки по скриптингу

Модератор: SJplayer

Аватара
Автор темы
Miranda F
Старшина
Старшина
Сообщения: 122
Репутация: 11
С нами: 4 года 7 месяцев

Выбор скина на текстдравах

Сообщение #1 Miranda » 24 мая 2014, 15:31

Изображение


Ко всем new:

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

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


В GameModeInit:

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

LoadTextDraws();  


В public OnPlayerSpawn(playerid)

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

if(ClothesRound[playerid] == 1)
    {
            
SetPlayerVirtualWorld(playeridplayerid);
            
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(playerid0);
            
TextDrawShowForPlayer(playerid,ButtonLeft);
            
TextDrawShowForPlayer(playerid,ButtonRight);
        
TextDrawShowForPlayer(playerid,ButtonSelect);
        
SelectTextDraw(playerid0xFF4040AA);
        if(
PlayerInfo[playerid][pSex] == 1SetPlayerSkin(playerid78), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 78;
        else 
SetPlayerSkin(playerid12), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 12


В конец мода:

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

public OnPlayerClickTextDraw(playeridText:clickedid)
{
    if(
ClothesRound[playerid] == 1)
    {
        if(
clickedid == ButtonRight)
        {
             if(
PlayerInfo[playerid][pSex] == 1)
            {
                switch(
SelectCharRegID[playerid])
                {
                    case 
1SetPlayerSkin(playerid79), SelectCharRegID[playerid] = 2ChosenSkin[playerid] = 79;
                    case 
2SetPlayerSkin(playerid135), SelectCharRegID[playerid] = 3ChosenSkin[playerid] = 135;
                    case 
3SetPlayerSkin(playerid230), SelectCharRegID[playerid] = 4ChosenSkin[playerid] = 230;
                    case 
4SetPlayerSkin(playerid137), SelectCharRegID[playerid] = 5ChosenSkin[playerid] = 137;
                    case 
5SetPlayerSkin(playerid200), SelectCharRegID[playerid] = 6,ChosenSkin[playerid] = 200;
                    case 
6SetPlayerSkin(playerid78), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 78;
                }
            }
              else
             {
                 switch(
SelectCharRegID[playerid])
                {
                    case 
1SetPlayerSkin(playerid13), SelectCharRegID[playerid] = 2ChosenSkin[playerid] = 13;
                    case 
2SetPlayerSkin(playerid55), SelectCharRegID[playerid] = 3ChosenSkin[playerid] = 55;
                    case 
3SetPlayerSkin(playerid90), SelectCharRegID[playerid] = 4ChosenSkin[playerid] = 90;
                    case 
4SetPlayerSkin(playerid193), SelectCharRegID[playerid] = 5ChosenSkin[playerid] = 193;
                    case 
5SetPlayerSkin(playerid12), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 12;
                   }
             }
        }
        else if(
clickedid == ButtonLeft)
        {
             if(
PlayerInfo[playerid][pSex] == 1)
            {
                switch(
SelectCharRegID[playerid])
                {
                    case 
1SetPlayerSkin(playerid200), SelectCharRegID[playerid] = 6ChosenSkin[playerid] = 200;
                    case 
6SetPlayerSkin(playerid137), SelectCharRegID[playerid] = 5ChosenSkin[playerid] = 137;
                    case 
5SetPlayerSkin(playerid230), SelectCharRegID[playerid] = 4ChosenSkin[playerid] = 230;
                    case 
4SetPlayerSkin(playerid135), SelectCharRegID[playerid] = 3ChosenSkin[playerid] = 135;
                    case 
3SetPlayerSkin(playerid79), SelectCharRegID[playerid] = 2ChosenSkin[playerid] = 79;
                    case 
2SetPlayerSkin(playerid78), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 78;
                  }
            }
              else
             {
                 switch(
SelectCharRegID[playerid])
                {
                    case 
1SetPlayerSkin(playerid193), SelectCharRegID[playerid] = 5ChosenSkin[playerid] = 193;
                    case 
5SetPlayerSkin(playerid90), SelectCharRegID[playerid] = 4ChosenSkin[playerid] = 90;
                    case 
4SetPlayerSkin(playerid55), SelectCharRegID[playerid] = 3ChosenSkin[playerid] = 55;
                    case 
3SetPlayerSkin(playerid13), SelectCharRegID[playerid] = 2ChosenSkin[playerid] = 13;
                    case 
2SetPlayerSkin(playerid12), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 12;
                   }
            }
        }
        else if(
clickedid == ButtonSelect)
        {
               
PlayerInfo[playerid][pModel] = ChosenSkin[playerid];
            
SelectCharRegID[playerid] = 0;
            
ClothesRound[playerid] = 0;
            
TogglePlayerControllable(playerid1);
            
OnPlayerRegister(playerid,PlayerInfo[playerid][pPassword]);
             
TextDrawHideForPlayer(playerid,ButtonLeft);
            
TextDrawHideForPlayer(playerid,ButtonRight);
            
TextDrawHideForPlayer(playerid,ButtonSelect);
            
CancelSelectTextDraw(playerid);
            
SetPlayerVirtualWorld(playerid,0);
            
SendClientMessage(playerid,-1,"Регистрация прошла успшено");
            
SetSpawnInfo(playerid255PlayerInfo[playerid][pModel], 0001.0, -1, -1, -1, -1, -1, -1);
            
SpawnPlayer(playerid);
            
PlayerInfo[playerid][pLevel] = 1;
            
SetPlayerPos(playerid,-1967.6738,115.7038,27.6875);
            
SetPlayerFacingAngle(playerid101.2675);
            
SetPlayerInterior(playerid,0);
            
SetPlayerVirtualWorld(playerid0);
            
SetPlayerScore(playerid,1);
        }
        if(
clickedid == Text:INVALID_TEXT_DRAW)
        {
            if(
ClothesRound[playerid] == 1)
            {
                
TogglePlayerControllable(playerid0);
                
TextDrawShowForPlayer(playerid,ButtonLeft);
                
TextDrawShowForPlayer(playerid,ButtonRight);
                
TextDrawShowForPlayer(playerid,ButtonSelect);
                
SelectTextDraw(playerid0xFF4040AA);
                if(
PlayerInfo[playerid][pSex] == 1SetPlayerSkin(playerid78), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 78;
                else 
SetPlayerSkin(playerid12), SelectCharRegID[playerid] = 1ChosenSkin[playerid] = 12;
            }
        }
    }
    return 
1;
}  


И stock

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

stock LoadTextDraws()
{
    
ButtonLeft TextDrawCreate(50.0200.0"LD_BEAT:left");
    
TextDrawFont(ButtonLeft4);
    
TextDrawTextSize(ButtonLeft5025);
    
TextDrawSetSelectable(ButtonLeft1);

    
ButtonRight TextDrawCreate(530.0200.0"LD_BEAT:right");
    
TextDrawFont(ButtonRight4);
    
TextDrawTextSize(ButtonRight5025);
    
TextDrawSetSelectable(ButtonRight1);

    
ButtonSelect TextDrawCreate(382.000000371.000000"Select");
    
TextDrawTextSize(ButtonSelect482.022.0);
    
TextDrawBackgroundColor(ButtonSelect255);
    
TextDrawFont(ButtonSelect3);
    
TextDrawLetterSize(ButtonSelect0.8999992.400000);
    
TextDrawColor(ButtonSelect869072895);
    
TextDrawSetOutline(ButtonSelect0);
    
TextDrawSetProportional(ButtonSelect1);
    
TextDrawSetShadow(ButtonSelect1);
    
TextDrawSetSelectable(ButtonSelect1);
}  
Изображение

! ! !


  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

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

Кто сейчас на форуме

Сейчас этот раздел просматривают: 1 гость
Боты: Yandex [Bot]