[Урок] /invite с приглашением в диалоге

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

Moderator: SJplayer

Avatar
Topic author
Invi_Sasha M
Мл. сержант
Мл. сержант
Posts: 34
With us: 7 years 4 months

[Урок] /invite с приглашением в диалоге

Post #1by Invi_Sasha » 20 May 2013, 21:52

Всем доброго времени суток.


Команду вставляем в OnPlayerCommandText


Code: Select all

if(strcmp(cmd"/invite"true) == 0)
    {
            if(
IsPlayerConnected(playerid))
            {
                    
tmp strtok(cmdtextidx);
                    if(!
strlen(tmp))
                    {
                    
SendClientMessage(playeridCOLOR_WHITE"Введите: /invite [id]");
                    return 
1;
                    }
                    new 
para1;
                    
para1 ReturnUser(tmp);
                    if (
PlayerInfo[playerid][pLeader] >= 1)
                    {
                            if(
IsPlayerConnected(para1))
                            {
                                    if(
para1 != INVALID_PLAYER_ID)
                                    {
                                    
GetPlayerName(para1giveplayersizeof(giveplayer));
                                    
GetPlayerName(playeridsendernamesizeof(sendername));
                                    if (
PlayerInfo[para1][pMember] == && PlayerInfo[para1][pLeader] == 0) { } else {SendClientMessage(playeridCOLOR_GRAD1"Этот человек уже состоит в фракции."); return 1;}
                                 if (
PlayerInfo[para1][pWarns] == 0) { } else {SendClientMessage(playeridCOLOR_GRAD1"Нельзя принять с Warnom.");return 1;}
                                    {
                                                    new 
str[256];
                                                    {
                                                         if(
PlayerInfo[playerid][pLeader] == 1||(PlayerInfo[playerid][pMember]==1&&PlayerInfo[playerid][pRank]>=6)) {format(strsizeof(str), "Лидер %s приглашает вас вступить в LSPD\nВы хотите вступить в LSPD?",sendername); ShowPlayerDialog(para1,25000,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 2||(PlayerInfo[playerid][pMember]==2&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в FBI\nВы хотите вступить в FBI?",sendername); ShowPlayerDialog(para1,25001,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 3||(PlayerInfo[playerid][pMember]==3&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в National Guard\nВы хотите вступить в National Guard?",sendername); ShowPlayerDialog(para1,25002,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 4||(PlayerInfo[playerid][pMember]==4&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в МЧС\nВы хотите вступить в МЧС?",sendername); ShowPlayerDialog(para1,25003,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 5||(PlayerInfo[playerid][pMember]==5&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в La Cosa Nostra\nВы хотите вступить в La Cosa Nostra?",sendername); ShowPlayerDialog(para1,25004,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 6||(PlayerInfo[playerid][pMember]==6&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в Yakuza\nВы хотите вступить в Yakuza?",sendername); ShowPlayerDialog(para1,25005,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 7||(PlayerInfo[playerid][pMember]==7&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в Такси\nВы хотите вступить в Такси?",sendername); ShowPlayerDialog(para1,25006,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 8||(PlayerInfo[playerid][pMember]==8&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в Наёмные Убийцы\nВы хотите вступить в Наёмные Убийцы?",sendername); ShowPlayerDialog(para1,25007,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                    else if(
PlayerInfo[playerid][pLeader] == 9||(PlayerInfo[playerid][pMember]==9&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в NEWS\nВы хотите вступить в NEWS?",sendername); ShowPlayerDialog(para1,25008,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                    else if(
PlayerInfo[playerid][pLeader] == 10||(PlayerInfo[playerid][pMember]==10&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в Инструкторы\nВы хотите вступить в Инструкторы?",sendername); ShowPlayerDialog(para1,25009,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 11||(PlayerInfo[playerid][pMember]==11&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в The Ballas Gang\nВы хотите вступить в The Ballas Gang?",sendername); ShowPlayerDialog(para1,25010,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 12||(PlayerInfo[playerid][pMember]==12&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в The Grove Street Gang\nВы хотите вступить в The Grove Street Gang?",sendername); ShowPlayerDialog(para1,25011,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 13||(PlayerInfo[playerid][pMember]==13&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в The Vagos Gang\nВы хотите вступить в The Vagos Gang?",sendername); ShowPlayerDialog(para1,25012,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 14||(PlayerInfo[playerid][pMember]==14&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в The El Coronos Gang\nВы хотите вступить в The El Coronos Gang?",sendername); ShowPlayerDialog(para1,25013,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else if(
PlayerInfo[playerid][pLeader] == 15||(PlayerInfo[playerid][pMember]==15&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в The Rifa Gang\nВы хотите вступить в The Rifa Gang?",sendername); ShowPlayerDialog(para1,25014,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                    else if(
PlayerInfo[playerid][pLeader] == 16||(PlayerInfo[playerid][pMember]==16&&PlayerInfo[playerid][pRank]>=6)) { format(strsizeof(str), "Лидер %s приглашает вас вступить в Russian Mafia\nВы хотите вступить в Russian Mafia?",sendername); ShowPlayerDialog(para1,25015,DIALOG_STYLE_MSGBOX,"Приглашение",str,"Да","Нет");}
                                                         else { return 
1; }
                                                    }
                                                    
format(stringsizeof(string), "Вы пригласили %s присоединиться к фракции."giveplayer);
                                                    
SendClientMessage(playeridCOLOR_GRAD1string);
                                                 }
                                           }
                            }
//not connected
                    
}
                 }
            return 
1;
    }
 

Это в public OnDialogResponse

Code: Select all

if(dialogid == 25000 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 280SetPlayerSkin(playerid280);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 211SetPlayerSkin(playerid211);}
  
PlayerInfo[playerid][pMember] = 1;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 2;
  
gTeam[playerid] = 2;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid == 25001 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 285SetPlayerSkin(playerid285);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 76SetPlayerSkin(playerid76);}
  
PlayerInfo[playerid][pMember] = 2;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pChar] = 285;
  
PlayerInfo[playerid][pTeam] = 2;
  
SetPlayerSkin(playerid285);
  
gTeam[playerid] = 2;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25002 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 287SetPlayerSkin(playerid287);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 191SetPlayerSkin(playerid191);}
  
PlayerInfo[playerid][pMember] = 3;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 2;
  
gTeam[playerid] = 2;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25003 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 70SetPlayerSkin(playerid70);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 150SetPlayerSkin(playerid150);}
  
PlayerInfo[playerid][pMember] = 4;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 1;
  
gTeam[playerid] = 1;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25004 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 127SetPlayerSkin(playerid127);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 12SetPlayerSkin(playerid12);}
  
PlayerInfo[playerid][pMember] = 5;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 5;
  
gTeam[playerid] = 5;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25005 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 121SetPlayerSkin(playerid121);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 169SetPlayerSkin(playerid169);}
  
PlayerInfo[playerid][pMember] = 6;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 5;
  
gTeam[playerid] = 5;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25006 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 261SetPlayerSkin(playerid261);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 76SetPlayerSkin(playerid76);}
  
PlayerInfo[playerid][pMember] = 7;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 7;
  
gTeam[playerid] = 7;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25007 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 166SetPlayerSkin(playerid166);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 40SetPlayerSkin(playerid40);}
  
PlayerInfo[playerid][pMember] = 8;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 10;
  
gTeam[playerid] = 10;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25008 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 290SetPlayerSkin(playerid290);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 214SetPlayerSkin(playerid214);}
  
PlayerInfo[playerid][pMember] = 9;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 12;
  
gTeam[playerid] = 12;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25009 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 59SetPlayerSkin(playerid59);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 11SetPlayerSkin(playerid11);}
  
PlayerInfo[playerid][pMember] = 10;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 11;
  
gTeam[playerid] = 11;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25010 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 28SetPlayerSkin(playerid28);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 190SetPlayerSkin(playerid190);}
  
PlayerInfo[playerid][pMember] = 11;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 12;
  
gTeam[playerid] = 12;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25011 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 105SetPlayerSkin(playerid105);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 207SetPlayerSkin(playerid207);}
  
PlayerInfo[playerid][pMember] = 12;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 13;
  
gTeam[playerid] = 13;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25012 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 108SetPlayerSkin(playerid108);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 193SetPlayerSkin(playerid193);}
  
PlayerInfo[playerid][pMember] = 13;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 14;
  
gTeam[playerid] = 14;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25013 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 47SetPlayerSkin(playerid47);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 41SetPlayerSkin(playerid41);}
  
PlayerInfo[playerid][pMember] = 14;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 15;
  
gTeam[playerid] = 15;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25014 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 30SetPlayerSkin(playerid30);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 69SetPlayerSkin(playerid69);}
  
PlayerInfo[playerid][pMember] = 15;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 12;
  
gTeam[playerid] = 12;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;
}
if(
dialogid==25015 && response)
{
         if(
PlayerInfo[playerid][pSex] == 1) { PlayerInfo[playerid][pChar] = 206SetPlayerSkin(playerid206);}
         else if(
PlayerInfo[playerid][pSex] == 2) { PlayerInfo[playerid][pChar] = 69SetPlayerSkin(playerid69);}
  
PlayerInfo[playerid][pMember] = 16;
  
PlayerInfo[playerid][pRank] = 1;
  
PlayerInfo[playerid][pTeam] = 16;
  
gTeam[playerid] = 16;
  
PlayerInfo[playerid][pLocal] = 255;
  
SetPlayerToTeamColor(playerid);
  
SpawnPlayer(playerid);
  
MedicBill[playerid] = 0;


Текст меняйте на свой. id диалогов тоже меняйте на свои, если заняты. На этом всё.
Автор: Неизвестен

! ! !


Return to “Уроки”

Who is online

Users browsing this forum: 1 guest