Больница немного похожая на Адванс

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

Moderator: SJplayer

Avatar
Topic author
Miranda F
Старшина
Старшина
Posts: 143
With us: 7 years 2 months

Больница немного похожая на Адванс

Post #1by Miranda » 24 Oct 2013, 19:37

Больница немного похожая на Адванс
Авторы:Franklin И немного взял из работы DmX

Координаты меняйте на свои
Интерьер делайте сами!
1. это ко всем new

Code: Select all

new HospitalBed[4];  


далее в форварды вставляем это

Code: Select all

forward HP(playerid);  


Теперь в pInfo вставляем это

Code: Select all

pKouka1,
pKouka2,
pKouka3,
pKouka4,
pBolnica


в public OnPlayerDeath(playerid, killerid, reason) добавляете

Code: Select all

new para1;
PlayerInfo[para1][pBolnica] = 1;  


в public OnPlayerSpawn(playerid) добавляете вот это

Code: Select all

    if(PlayerInfo[playerid][pBolnica] == 1)
    {
        
SetPlayerHealthAC(playerid30.0);
        
SetPlayerFacingAngle(playerid90);
        
SetPlayerInterior(playerid0);
        
SetPlayerVirtualWorld(playerid0);
        
SetPlayerPos(playerid,1027.9110107422,72.166999816895,3356.2351074219);
        new 
Bolnica1[] = "{29ff00}Ваш текст при попадание в больницу и цвет счас стоит зеленый";
        
ShowPlayerDialog(playerid,32121,DIALOG_STYLE_MSGBOX,"Справка",Bolnica1,"Хорошо","");
        return 
1;
    }  


Далее делаем паблик выдачи ХП

Code: Select all

public HP(playerid)
{
    new 
string[312];
    if(
PlayerInfo[playerid][pKouka1] == || PlayerInfo[playerid][pKouka2] == || PlayerInfo[playerid][pKouka3] == || PlayerInfo[playerid][pKouka4] == 1)
    {
        new 
Float:health;
        
GetPlayerHealth(playeridhealth);
        if (
health 95)
        {
            
SetPlayerHealthAC(playeridhealth 5.0);
            
format(stringsizeof(string), "+5hp");
            
GameTextForPlayer(playeridstring10003);
        }
        else
        {
            if(
PlayerInfo[playerid][pKouka1] == || PlayerInfo[playerid][pKouka2] == || PlayerInfo[playerid][pKouka3] == || PlayerInfo[playerid][pKouka4] == 1)
            {
                
SendClientMessage(playeridCOLOR_GREY"Вы здоровы!");
                
PlayerInfo[playerid][pKouka1] = 0;
                
PlayerInfo[playerid][pKouka2] = 0;
                
PlayerInfo[playerid][pKouka3] = 0;
                
PlayerInfo[playerid][pKouka4] = 0;
                
PlayerInfo[playerid][pBolnica] = 0;
                for(new 
d4d++)
                {
                    if(
HospitalBed[d] != playerid) continue;
                    else
                    {
                        
HospitalBed[d] = INVALID_PLAYER_ID;
                        break;
                    }
                }
            }
        }
    }
    return 
1;
}  


теперь добавьте в public OnPlayerRegister(playerid, password[]) и в public OnPlayerUpdateRL(playerid)

Code: Select all

ini_setInteger(File,"Больница",PlayerInfo[playerid][pBolnica]);
ini_setInteger(File,"Kouka1",PlayerInfo[playerid][pKouka1]);
ini_setInteger(File,"Kouka2",PlayerInfo[playerid][pKouka2]);
ini_setInteger(File,"Kouka3",PlayerInfo[playerid][pKouka3]);
ini_setInteger(File,"Kouka4",PlayerInfo[playerid][pKouka4]);  


в public OnPlayerLogin(playerid,password[])

Code: Select all

ini_getInteger(File,"Больница",PlayerInfo[playerid][pBolnica]);
ini_getInteger(File,"Kouka1",PlayerInfo[playerid][pKouka1]);
ini_getInteger(File,"Kouka2",PlayerInfo[playerid][pKouka2]);
ini_getInteger(File,"Kouka3",PlayerInfo[playerid][pKouka3]);
ini_getInteger(File,"Kouka4",PlayerInfo[playerid][pKouka4]);  


В public OnPlayerDisconnect(playerid, reason)

Code: Select all

for(new d4d++)
    {
        if(
HospitalBed[d] != playerid) continue;
        else
        {
            
HospitalBed[d] = INVALID_PLAYER_ID;
            break;
        }
    }
    
PlayerInfo[playerid][pKouka1] = 0;
    
PlayerInfo[playerid][pKouka2] = 0;
    
PlayerInfo[playerid][pKouka3] = 0;
    
PlayerInfo[playerid][pKouka4] = 0;  


Добавляю команду /hospital кто не знает это в паблик OnPlayerCommandText

Code: Select all

else if(strcmp(cmd"/hospital"true) == 0)
    {
        new 
Float:health;
        
GetPlayerHealth(playeridhealth);
        if(
health 95) return 1;
        if(
PlayerInfo[playerid][pKouka1] == || PlayerInfo[playerid][pKouka2] == 1
        
|| PlayerInfo[playerid][pKouka3] == || PlayerInfo[playerid][pKouka4] == 1)
        return 
SendClientMessage(playeridCOLOR_GREY"Вы уже лежите в больниц!");
        if(
PlayerToPoint(3.0,playerid,1025.7496,80.0536,3356.8826))//1
        
{
            if(
HospitalBed[0] != INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GREY"Койка под номером 1 уже занята!");
            
SendClientMessage(playeridCOLOR_GREY"Вы заняли койку под номером 1!");
            
PlayerInfo[playerid][pKouka1] = 1;
            
HospitalBed[0] = playerid;
        }
        else if(
PlayerToPoint(3.0,playerid,1025.7427,83.6644,3356.8826))//2
        
{
            if(
HospitalBed[1] != INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GREY"Койка под номером 2 уже занята!");
            
SendClientMessage(playeridCOLOR_GREY"Вы заняли койку под номером 2!");
            
PlayerInfo[playerid][pKouka2] = 1;
            
HospitalBed[1] = playerid;
        }
        else if(
PlayerToPoint(3.0,playerid,1034.0323,80.2212,3356.8826))//3
        
{
            if(
HospitalBed[2] != INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GREY"Койка под номером 3 уже занята!");
            
SendClientMessage(playeridCOLOR_GREY"Вы заняли койку под номером 3!");
            
PlayerInfo[playerid][pKouka3] = 1;
            
HospitalBed[2] = playerid;
        }
        else if(
PlayerToPoint(3.0,playerid,1034.0118,83.7613,3356.8826))//4
        
{
            if(
HospitalBed[3] != INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_GREY"Койка под номером 4 уже занята!");
            
SendClientMessage(playeridCOLOR_GREY"Вы заняли койку под номером 4!");
            
PlayerInfo[playerid][pKouka4] = 1;
            
HospitalBed[3] = playerid;
        }
        return 
1;
    }  


Теперь в OnGameModeInIt

Code: Select all

HospitalBed[0] = INVALID_PLAYER_ID
HospitalBed[1] = INVALID_PLAYER_ID
HospitalBed[2] = INVALID_PLAYER_ID
HospitalBed[3] = INVALID_PLAYER_ID;
SetTimer("HP"10000true);  
Image

! ! !


  • Similar Topics
    Replies
    Views
    Last post

Return to “Уроки”

Who is online

Users browsing this forum: 1 guest
Bots: Bing [Bot]