• Страница 1 из 1
  • 1
Учимся плавать.
Дмитрий Дата: Понедельник, 27.08.2012, 13:43 | Сообщение # 1 | Сообщить о нерабочей теме


Аватар для Дмитрий

И так в этом уроке я расскажу как сделать что бы определённая фракция
учила игроков плавать.

И так преступим :

1. В enum pInfo
Code
pLicSwim,  


2. Далее в OnPlayerConnect

Code
PlayerInfo[playerid][pLicSwim] = 0;  


3.Далее в public SetPlayerUnjail()

Code
        if(PlayerInfo[i][pLicSwim] <= 0 && GetPlayerState(i) == 1)  
             {  
                 new animlib[32],animname[32];  
                 GetAnimationName(GetPlayerAnimationIndex(i),animlib,32,animname,32);  
                 if(!strcmp(animlib,"SWIM",true))  
                 {  
                     if(!strcmp(animname,"SWIM_BREAST",true) || !strcmp(animname,"SWIM_CRAWL",true) || !strcmp(animname,"SWIM_JUMPOUT",true) ||  
                     !strcmp(animname,"SWIM_DIVE_UNDER",true) || !strcmp(animname,"SWIM_GLIDE",true) || !strcmp(animname,"SWIM_UNDER",true))  
                     {  
                         if(GetPVarInt(i,"Mess") == 0)  
                         {  
                             SetPVarInt(i,"Mess",1);  
                             SendClientMessage(i,-1,"{FF2211}Вы не умеете плавать");  
                         }  
                         SetPVarInt(i,"Lalalas",1);  
                     }  
                 }  
             }  


4. В OnPlayerRegister

Code
format(var, 32, "LicSwim=%d\n",PlayerInfo[playerid][pLicSwim]);fwrite(hFile, var);  


4.Далее в public OnPlayerUpdate

Code
format(var, 32, "LicSwim=%d\n",PlayerInfo[playerid][pLicSwim]);fwrite(hFile, var);  


5.Далее в public OnPlayerLogin(playerid,password[])

Code
if( strcmp( key , "LicSwim" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLicSwim] = strval( val ); }  


6. Далее команды :

Code
   if(strcmp(cmd,"/canswim",true) == 0)  
     {  
         if(PlayerInfo[playerid][pMember] != 20 && PlayerInfo[playerid][pLeader] != 20) return SendClientMessage(playerid,-1,"Вы не состоите во фракции Школа плавания");  
         if(PlayerInfo[playerid][pMember] == 20 && PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid,-1,"Нужен 3 ранг");  
         tmp = strtok(cmdtext,idx);  
         if(!strlen(tmp)) return SendClientMessage(playerid,-1,"/canswim [id]");  
         new id = ReturnUser(tmp);  
         if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"Нет такого игрока");  
         if(!ProxDetectorS(8.0, playerid, id)) return SendClientMessage(playerid,-1,"Вы слишком далеко");  
         PlayerInfo[id][pLicSwim] = 1;  
         GetPlayerName(playerid,playername,sizeof(playername));  
         GetPlayerName(id,sendername,sizeof(sendername));  
         format(string,sizeof(string),"%s выдал вам лицензию на плавание",playername);  
         SendClientMessage(id,COLOR_LIGHTBLUE,string);  
         format(string,sizeof(string),"Вы выдали %s лицензию на плавание",sendername);  
         SendClientMessage(playerid,COLOR_LIGHTBLUE,string);  
         //pLicSwim  
         return 1;  
     }  


Автор : Seemon


From Russia With Love!
  • Страница 1 из 1
  • 1
Поиск: