SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Русский/Russian

Reply
 
Thread Tools Display Modes
Old 12/07/2018, 06:33 PM   #1
Johhnyllll
Huge Clucker
 
Johhnyllll's Avatar
 
Join Date: Sep 2014
Posts: 223
Reputation: 8
Default Выбор скина при помощи AddPlayerClassEx и OnPlayerRequestClass.

Как можно сделать выбор скина при помощи AddPlayerClassEx и OnPlayerRequestClass?

Я попопробовал сделать так:
PHP Code:
public OnGameModeInit(){
    
// Selection
        //male
    
AddPlayerClassEx(02300,0,0,00,0,0,0,0,0);
    
AddPlayerClassEx(02120,0,0,00,0,0,0,0,0);
    
AddPlayerClassEx(02000,0,0,00,0,0,0,0,0);
        
//female
    
AddPlayerClassEx(1390,0,0,00,0,0,0,0,0);
    
AddPlayerClassEx(1540,0,0,00,0,0,0,0,0);
    
AddPlayerClassEx(1770,0,0,00,0,0,0,0,0);
        return 
true;

Выбор пола через диалог (mdialog).
PHP Code:
DialogCreate:d_user_select_gender(playerid){
    
Dialog_Open(playeridDialog:d_user_select_genderDIALOG_STYLE_MSGBOX"Выберите пол персонажа"," ","Мужской","Женский");
}
DialogResponse:d_user_select_gender(playeridresponselistiteminputtext[])
{
    if(!
response) return SetPlayerTeam(playerid1), TogglePlayerSpectating(playerid0); //female
    
SetPlayerTeam(playerid0); //male
    
TogglePlayerSpectating(playerid0);
    
//orm_insert(P[playerid][_p_ormid], "OnMySQL_InsertAccount", "d", playerid);
    
return true;

PHP Code:
public OnPlayerRequestClass(playeridclassid)
{
        
printf("Team: %d",GetPlayerTeam(playerid));
    if(
P[playerid][_p_in_game] == true) {
            
// код который не имеет значение в данном случае.
    
}
    else{
                
// Выбор персонажа
        
SetPlayerInterior(playerid0);
        
SetPlayerPos(playerid,1984.4445,157.9501,55.9384);
        
SetPlayerFacingAngle(playerid,0.0);
        
InterpolateCameraPos(playerid1984.4445,160.9501,55.93841984.4445,160.9501,55.93841000);
        
InterpolateCameraLookAt(playerid1984.4445,157.9501,55.93841984.4445,157.9501,55.93841000);

                
// первый вариант
        
if(GetPlayerTeam(playerid) == 0){
            
printf("asdas12312");
            if(
GetPlayerSkin(playerid) == 39) return SetPlayerSkin(playerid230), SetPlayerTeam(playerid0);
            else if(
GetPlayerSkin(playerid) == 54) return SetPlayerSkin(playerid212), SetPlayerTeam(playerid0);
            else if(
GetPlayerSkin(playerid) == 77) return SetPlayerSkin(playerid200), SetPlayerTeam(playerid0);
        }
        else if(
GetPlayerTeam(playerid) == 1){
            
printf("asdas");
            if(
GetPlayerSkin(playerid) == 230) return SetPlayerSkin(playerid39), SetPlayerTeam(playerid0);
            else if(
GetPlayerSkin(playerid) == 212) return SetPlayerSkin(playerid54), SetPlayerTeam(playerid0);
            else if(
GetPlayerSkin(playerid) == 200) return SetPlayerSkin(playerid77), SetPlayerTeam(playerid0);
        }

                
// второй вариант | с использованием switch
                
if(GetPlayerTeam(playerid) == 0){
            switch(
classid){
                case 
0SetPlayerSkin(playerid230);
                case 
1SetPlayerSkin(playerid212);
                case 
2SetPlayerSkin(playerid200);
                default: 
SetPlayerSkin(playerid230);
            }
            return 
true;
        }
        else if(
GetPlayerTeam(playerid) == 1){
            switch(
classid){
                case 
0SetPlayerSkin(playerid39);
                case 
1SetPlayerSkin(playerid54);
                case 
2SetPlayerSkin(playerid77);
                default: 
SetPlayerSkin(playerid39);
            }
            return 
true;
        }
        }
        
printf("%i"classid);
        return 
true;

Оба этих вариантов нерабочие.
Первая заметка:
Обнуление classid или установка какого-то значения ниначто не влияют. Можно поставить classid = 0; и выбор скинов так-же будет работать.

Вторая заметка:
PHP Code:
printf("Team: %d",GetPlayerTeam(playerid)); 
Показывает разные значения в зависимости от "пола" скинов которых я указал.

Между классами 200 и 230 = GetPlayerTeam(playerid) равен нулю.
Между классами 39 и 77 = GetPlayerTeam(playerid) равен 1. Хотя я ничего не меняю...
Я не знаю как это фиксить и возможно это главная причина почему у меня система работает ошибочно.

P.S: Надеюсь я всё доступно объяснил.
__________________
Мои проекты: GitHub
Johhnyllll is offline   Reply With Quote
Old 13/07/2018, 07:59 PM   #2
Johhnyllll
Huge Clucker
 
Johhnyllll's Avatar
 
Join Date: Sep 2014
Posts: 223
Reputation: 8
Default Re: Выбор скина при помощи AddPlayerClassEx и OnPlayerRequestClass.

Нашел оптимальный вариант.
PHP Code:
// OnGameModeInit
        // Selection
        //male
    
AddPlayerClass(2300,0,0,00,0,0,0,0,0);
    
AddPlayerClass(2120,0,0,00,0,0,0,0,0);
    
AddPlayerClass(2000,0,0,00,0,0,0,0,0);
        
//female
    
AddPlayerClass(390,0,0,00,0,0,0,0,0);
    
AddPlayerClass(540,0,0,00,0,0,0,0,0);
    
AddPlayerClass(770,0,0,00,0,0,0,0,0); 
PHP Code:
// Диалог
if(!response) return SetPVarInt(playerid"Gender"2), TogglePlayerSpectating(playerid0); //female
    
SetPVarInt(playerid"Gender"1); // male
    
TogglePlayerSpectating(playerid0); 
PHP Code:
// OnPlayerRequestClass
if(GetPVarInt(playerid"Gender") == 1){
            switch(
classid){
                case 
0SetPlayerSkin(playerid230);
                case 
1SetPlayerSkin(playerid212);
                case 
2SetPlayerSkin(playerid200);
                case 
3SetPlayerSkin(playerid230);
                case 
4SetPlayerSkin(playerid212);
                case 
5SetPlayerSkin(playerid200);
            }
        } else if(
GetPVarInt(playerid"Gender") == 2){
            switch(
classid){
                case 
0SetPlayerSkin(playerid39);
                case 
1SetPlayerSkin(playerid54);
                case 
2SetPlayerSkin(playerid77);
                case 
3SetPlayerSkin(playerid39);
                case 
4SetPlayerSkin(playerid54);
                case 
5SetPlayerSkin(playerid77);
            }
        } 
__________________
Мои проекты: GitHub
Johhnyllll is offline   Reply With Quote
Old 14/07/2018, 10:11 AM   #3
Eims
Huge Clucker
 
Eims's Avatar
 
Join Date: May 2013
Location: Восточный Мордор
Posts: 426
Reputation: 12
Default Re: Выбор скина при помощи AddPlayerClassEx и OnPlayerRequestClass.

Загугли "ds__skin_selector". Я в этой библиотеке делал нечто подобное, только в более удобном виде
__________________
- How many IT Engineers does it take to fix a broken light bulb?
- None, the light bulb works fine in my office, I cannot replicate the issue.
Eims is offline   Reply With Quote
Old 14/07/2018, 07:48 PM   #4
Johhnyllll
Huge Clucker
 
Johhnyllll's Avatar
 
Join Date: Sep 2014
Posts: 223
Reputation: 8
Default Re: Выбор скина при помощи AddPlayerClassEx и OnPlayerRequestClass.

Quote:
Originally Posted by Eims View Post
Загугли "ds__skin_selector". Я в этой библиотеке делал нечто подобное, только в более удобном виде
Спасибо, обязательно посмотрю.
__________________
Мои проекты: GitHub
Johhnyllll is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Выбор скина Darge Русский/Russian 5 29/03/2015 01:28 PM
Выбор скина. Johhnyllll Русский/Russian 18 07/10/2014 02:45 PM
Прошу помощи с Dini DrSlett Русский/Russian 1 24/09/2012 06:35 PM
[HELP] About AddPlayerClassEx tuuker Help Archive 3 03/03/2011 09:43 PM
Как сделать выбор скина после регистрации durelom Русский/Russian 21 13/10/2010 06:21 PM


All times are GMT. The time now is 05:02 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.