[Мануал] Вход По Пропускам

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

Moderator: SJplayer

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

[Мануал] Вход По Пропускам

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

Всем привет , вот вам не надоело, что все входят без очереди? Суть мануала: чтобы человек который состоит в организации мог выдавать ключ\пропуск.



В enum pInfo :

Code: Select all

pPropusk,


В public OnPlayerCommandText :

Code: Select all

if(strcmp(cmd, "/propusk", true) == 0)  
        
{  
                if
(IsPlayerConnected(playerid))  
                
{  
                        tmp 
= strtok(cmdtext, idx);  
                        if
(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD2, " Используйте: /propusk[id/Name]");  
                        new plo
;  
                        plo 
= ReturnUser(tmp);  
                        if 
(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1) // Можете сделать свою фракцию  
                        {  
                                if
(IsPlayerConnected(plo))  
                                
{  
                                        if
(PlayerInfo[plo][pPropusk] == 0) // Если у игрока нету пропуска выполняем действие ниже (выдаём пропуск)  
                {  
                                                PlayerInfo
[plo][pPropusk] = 1;// Выдаём пропуск  
                                                GetPlayerName(playerid, sendername, sizeof(sendername));  
                                                GetPlayerName
(plo, giveplayer, sizeof(giveplayer));  
                                                format
(string, sizeof(string), "Вы выдали %s пропуск",giveplayer);  
                                                SendClientMessage
(playerid, COLOR_LIGHTBLUE, string);  
                                                format
(string, sizeof(string), "%s выдал вам пропуск",sendername);  
                                                SendClientMessage
(plo, COLOR_LIGHTBLUE, string);  
                                                
}  
                                                else  
                                                
{  
                                                PlayerInfo
[plo][pPropusk] = 0; // если у игрока есть пропуск,то забираем.  
                                                GetPlayerName(playerid, sendername, sizeof(sendername));  
                                                GetPlayerName
(plo, giveplayer, sizeof(giveplayer));  
                                                format
(string, sizeof(string), "Вы забрали у %s пропуск",giveplayer);  
                                                SendClientMessage
(playerid, COLOR_LIGHTBLUE, string);  
                                                format
(string, sizeof(string), "%s забрал у вас пропуск",sendername);  
                                                SendClientMessage
(plo, COLOR_LIGHTBLUE, string);  
                                        
}  
                                
}//not connected  
                        }  
                        else  
                        
{  
                                format
(string, sizeof(string), " %d-Такого игрока нету.", plo);  
                                SendClientMessage
(playerid, COLOR_GRAD1, string);  
                        
}  
                
}  
                return 1
;  
        
}


Делаем пикап входа:

Code: Select all

if(pickupid == wtf)  
        
{  
                SetPlayerInterior
(playerid, 3);  
                SetPlayerPos
(playerid, 288.5975,170.8983,1007.1794);// ТП  
        }



Делаем проверку на пропуск:

Code: Select all

if(pickupid == wtf)  
        
{  
                if
(PlayerInfo[playerid][pPropusk] != 1)  
                return SendClientMessage
(playerid, COLOR_GRAD1, " У вас нету пропуска");  
                SetPlayerInterior
(playerid, 3);  
                SetPlayerPos
(playerid, 288.5975,170.8983,1007.1794);// ТП  
        }


Автор: Looney

! ! !


Return to “Уроки”

Who is online

Users browsing this forum: 1 guest