Leksarut
Умник
Привет всем!
Сегодня мы сделаем больницу с поставлением диагноза для игрока.И так начнём:
Для начала найдём место в больнице где можно будет выдать мед.карточку(сохраняем координаты /save):
PHP:
if(strcmp(cmd,"/givemedics",true) == 0 || strcmp(cmd,"/выдатькарточку",true) == 0)
{
tmp = strtok(cmdtext,idx);
if(Player[playerid][pMember] == 4 || Player[playerid][pLeader] == 4)//номер фракции больницы
{
if(!strlen(tmp)) return SendClientMessage(playerid,-1,"Введите человека чтобы выдать карточку");
new id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"Этот человек сейчас не в штате");
new Float:cord[3];
GetPlayerPos(playerid,cord[0],cord[1],cord[2]);
if(IsPlayerInRangeOfPoint(id,20.0,cord[0],cord[1],cord[2]))
{
if(IsPlayerInRangeOfPoint(playerid,20.0,1139.6724,-1344.3414,2835.3809))//координаты выдачи.
{
Player[id][pMedcards] = 1;//сама карточка
new pname[32],pname1[32];
GetPlayerName(playerid,pname,32);
GetPlayerName(id,pname1,32);
new st[64],str[64],stri[100];
format(st,sizeof(st),"Вы выдали медицинскую карту %s",pname1);
format(str,sizeof(str),"Вам выдал медицинскую карту, работник %s",pname);
format(stri,sizeof(stri),"%s выдал медицинскую карту %s",pname,pname1);
SendClientMessage(id,COLOR_GREEN,str);
SendClientMessage(playerid,COLOR_RED,st);
SendRadioMessage(4,COLOR_RED,stri);
}
else SendClientMessage(playerid,-1,"Вы не на своём рабочем месте");
}
else SendClientMessage(playerid,-1,"Человека нет рядом с вами");
}
else SendClientMessage(playerid,-1,"Вы не работаете в больнице LS");
return 1;
}
PHP:
pMedcards,
PHP:
if(strcmp(cmd,"/fordiagnoz",true) == 0 || strcmp(cmd,"/длядиагноза",true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,2.0,1121.1448,-1343.8796,2836.1189))//координаты носилок
{
if(gMed[playerid] == 0)//если свободно место на носилках
{
if(Player[playerid][pMedcards] == 1)
{
SetPlayerPos(playerid,1121.1448,-1343.8796,2836.1189);//координаты
SetPlayerFacingAngle(playerid,181.3576);
ApplyAnimation(playerid, "BEACH", "bather", 4.1, 0, 1, 1, 1, 1, 1);//делаем анимацию игроку.
ApplyAnimation(playerid, "BEACH", "bather", 4.1, 0, 1, 1, 1, 1, 1);
SetTimer("anns",300,0);//таймер заморозки игрока.
gMed[playerid] = 1;//ставим значение койки-занято.
}
else SendClientMessage(playerid,-1,"У вас нет мед карты");
}
else SendClientMessage(playerid,-1,"Вы уже на носилках");
}
else SendClientMessage(playerid,COLOR_RED,"Вы не около носилок для проверки здоровья");
return 1;
}
PHP:
new gMed[MAX_PLAYERS];
PHP:
if(strcmp(cmd,"/unfordiagnoz",true) == 0 || strcmp(cmd,"/отдиагноза",true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,2.0,1121.1448,-1343.8796,2836.1189))//координаты носилок
{
if(gMed[playerid] == 1)//если игрок был на носилках
{
SetPlayerPos(playerid,1122.1332,-1344.1716,2835.3809);//телепортируем рядом с носилками
SetPlayerFacingAngle(playerid,178.2008);//устанавливаем камеру
TogglePlayerControllable(playerid,1);//размораживаем игрока
ClearAnimations(playerid);//Удаляем анимацию
gMed[playerid] = 0;//ставим свободную койку
}
else SendClientMessage(playerid,-1,"Вы не были на установлении диагноза");
}
else SendClientMessage(playerid,-1,"Вы не были на установлении диагноза");
return 1;
}
PHP:
forward anns(playerid);
public anns(playerid)
{
TogglePlayerControllable(playerid,0);
}
PHP:
if(strcmp(cmd,"/diagnoz",true)== 0 || strcmp(cmd,"/диагноз",true) == 0)
{
tmp = strtok(cmdtext,idx);
if(Player[playerid][pMember] == 4 || Player[playerid][pLeader] == 4)//если работает в больнице
{
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_RED,"Вы не сказали человека, кого диагноз хотите узнать");
new id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"Этот человек не в штате");
if(Player[id][pMedcards] == 1)//если у человека есть мед карта
{
if(gMed[id] == 1)//если он на койке
{
new ttext[32];
if(Player[id][pRanens] == 0) { ttext = "Нормально";}//переменную болезни меняйте на свою.
if(Player[id][pRanens] == 1) { ttext = "Сломанны";}
new string[128];
format(string,sizeof(string),"Ранения: %s",ttext);
ShowPlayerDialog(playerid,700,DIALOG_STYLE_MSGBOX,"Диагноз",string,"Понятно","");
ApplyAnimation(playerid, "BD_FIRE", "wash_up", 4.1, 0, 1, 1, 1, 1, 1);
SendClientMessage(id,-1,string);
}
else SendClientMessage(playerid,-1,"Человек не на носилках");
}
else SendClientMessage(playerid,-1,"У этого человека нет медицинской карты");
}
else SendClientMessage(playerid,-1,"Вы не работаете в больнице");
return 1;
}
PHP:
ini_getInteger(iniFile,"MedCards",Player[playerid][pMedcards]);
ini_setInteger(iniFile,"MedCards",Player[playerid][pMedcards]);
[HR][/HR]
[HR][/HR]
[HR][/HR]
[HR][/HR]
Всем спасибо!
Автор : leksarut
