Доступ к готовым решениям

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Мануал Делаем спортзал как на Samp-Rp

Статус
В этой теме нельзя размещать новые ответы.

$MaX$

Умник
Здравствуйте уважаемые пользователи Pawno-Info.Ru
Сегодня я выкладываю урок по созданию спортзала как на Samp-Rp
И так начнём!

Ко всем new:
PHP:
new winner[MAX_PLAYERS];
new sporthelp;
new boxform;
new boxforma[MAX_PLAYERS];
new InRing = 0;
new RoundStarted = 0;
new BoxDelay = 0;
new Boxer1 = 255;
new Boxer2 = 255;
new TBoxer = 255;
new PlayerBoxing[MAX_PLAYERS];
new BoxOffer[MAX_PLAYERS];
new BoxWaitTime[MAX_PLAYERS];
new sportMSG[12][] = {
/*0*/			{"{FFFFFF}Здесь вы можете выучить новый стиль боя\n"},
/*1*/			{"и немного подзаработать\n"},
/*2*/			{"Для начало занятия в зале переоденьтесь.\n"},
/*3*/			{"Если хотите участвовать в спарринге найдите тренера\n\n"},
/*4*/			{"И попросите устроить вам бой\n"},
/*5*/			{"Для изучения нового стиля боя вам надо:\n"},
/*6*/			{"1.Отрабатывать удары на груше\n"},
				{"Использовать разные приёмы для большего эффекта\n"},
/*7*/			{"\n"},
/*8*/			{"2.Победить несколько раз на ринге\n"},
/*9*/			{"\n"},
/*10*/			{"\n"}
};
Дальше в public OnPlayerDisconnect(playerid, reason) добавим
PHP:
   if(PlayerBoxing[playerid] > 0){
	    if(Boxer1 == playerid){
	     if(IsPlayerConnected(Boxer2)){
             PlayerBoxing[Boxer2] = 0;
	     SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
	     SetPlayerInterior(Boxer2, 5);
	     GameTextForPlayer(Boxer2, "~r~BREAK", 5000, 1);}}
	     else if(Boxer2 == playerid){
	     if(IsPlayerConnected(Boxer1)){
             PlayerBoxing[Boxer1] = 0;
	     SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
	     SetPlayerInterior(Boxer1, 5);
	     GameTextForPlayer(Boxer1, "~r~BREAK", 5000, 1);}}
	     InRing = 0;
             RoundStarted = 0;
	     Boxer1 = 255;
	     Boxer2 = 255;
	     TBoxer = 255;}
Ищем /accept или /use добавим
PHP:
					else if(strcmp(x_job,"fight",true) == 0)
			{
			    if(BoxOffer[playerid] < 999)
			    {
			        if(IsPlayerConnected(BoxOffer[playerid]))
			        {
			            GetPlayerName(BoxOffer[playerid], giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "Вы приняли вызов на бой от %s",giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "%s принял ваш вызов на бой",sendername);
						SendClientMessage(BoxOffer[playerid], COLOR_LIGHTBLUE, string);
						SetPlayerHealthNoCheat(playerid, 100);
						SetPlayerHealthNoCheat(BoxOffer[playerid], 100);
						SetPlayerInterior(playerid, 5); SetPlayerInterior(BoxOffer[playerid], 5);
						SetPlayerPos(playerid, 762.9852,2.4439,1001.5942); SetPlayerFacingAngle(playerid, 131.8632);
						SetPlayerPos(BoxOffer[playerid], 758.7064,-1.8038,1001.5942); SetPlayerFacingAngle(BoxOffer[playerid], 313.1165);
						TogglePlayerControllable(playerid, 0); TogglePlayerControllable(BoxOffer[playerid], 0);
						GameTextForPlayer(playerid, "~r~Waiting", 3000, 1); GameTextForPlayer(BoxOffer[playerid], "~r~Waiting", 3000, 1);
						new name[MAX_PLAYER_NAME];
						new dstring[MAX_PLAYER_NAME];
						new wstring[MAX_PLAYER_NAME];
						GetPlayerName(playerid, name, sizeof(name));
						format(dstring, sizeof(dstring), "%s", name);
						strmid(wstring, dstring, 0, strlen(dstring), 255);
						BoxWaitTime[playerid] = 1; BoxWaitTime[BoxOffer[playerid]] = 1;
						if(BoxDelay < 1) { BoxDelay = 5; }
						InRing = 1;
						Boxer1 = BoxOffer[playerid];
						Boxer2 = playerid;
                                                PlayerBoxing[playerid] = 1;
						PlayerBoxing[BoxOffer[playerid]] = 1;
						BoxOffer[playerid] = 999;
						return 1;
			        }
			        return 1;
			    }
				else return SendClientMessage(playerid, COLOR_GREY, "Вам ни кто не предлагал бой!");
			}
В public CustomPickups() добавим
PHP:
			if(BoxWaitTime[i] > 0)
			{
			    if(BoxWaitTime[i] >= BoxDelay)
				{
				    BoxDelay = 0;
					BoxWaitTime[i] = 0;
					PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
					GameTextForPlayer(i, "~g~Match Started", 5000, 1);
					TogglePlayerControllable(i, 1);
					RoundStarted = 1;
				}
			    else
				{
				    format(string, sizeof(string), "%d", BoxDelay - BoxWaitTime[i]);
					GameTextForPlayer(i, string, 1500, 6);
					BoxWaitTime[i] += 1;
				}
			}
			if(RoundStarted > 0)
			{
			    if(PlayerBoxing[i] > 0)
			    {
			        new trigger = 0;
			        new Lost = 0;
		        	new Float:angle;
		            new Float:health;
					GetPlayerHealth(i, health);
		            if(health < 12)
					{
					    if(i == Boxer1) { Lost = 1; trigger = 1; }
			            else if(i == Boxer2) { Lost = 2; trigger = 1; }
					}
			        if(health < 28) { GetPlayerFacingAngle(i, angle); SetPlayerFacingAngle(i, angle + 85); }
			        if(trigger)
			        {
			            new loser[MAX_PLAYER_NAME];
			            new titel[MAX_PLAYER_NAME];
			            if(Lost == 1)
			            {
			                if(IsPlayerConnected(Boxer1) && IsPlayerConnected(Boxer2))
			                {
					        	SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
                                SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
					        	SetPlayerInterior(Boxer1, 5); SetPlayerInterior(Boxer2, 5);
			                	GetPlayerName(Boxer1, loser, sizeof(loser));
			                	GetPlayerName(Boxer2, winner, sizeof(winner));
		                		if(PlayerInfo[Boxer1][pJob] == 12) { PlayerInfo[Boxer1][pLoses] += 1; }
								if(PlayerInfo[Boxer2][pJob] == 12) { PlayerInfo[Boxer2][pWins] += 1; }
			                	if(TBoxer < 255)
			                	{
			                	    if(IsPlayerConnected(TBoxer))
			                	    {
				                	    if(TBoxer != Boxer2)
				                	    {
				                	        if(PlayerInfo[Boxer2][pJob] == 10)
				                	        {
				                	            TBoxer = Boxer2;
				                	            GetPlayerName(TBoxer, titel, sizeof(titel));
					                	        new nstring[MAX_PLAYER_NAME];
												format(nstring, sizeof(nstring), "%s", titel);
												strmid(Titel[TitelName], nstring, 0, strlen(nstring), 255);
					                	        Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
					                	        Titel[TitelLoses] = PlayerInfo[TBoxer][pLoses];
					                	        SaveBoxer();
				                	        }
										}
										else
										{
										    GetPlayerName(TBoxer, titel, sizeof(titel));
											Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
				                	        Titel[TitelLoses] = PlayerInfo[Boxer2][pLoses];
				                	        SaveBoxer();
										}
									}
								}//TBoxer
								format(string, sizeof(string), "Вы проиграли борьбу против %s.", winner);
								SendClientMessage(Boxer1, COLOR_LIGHTBLUE, string);
								GameTextForPlayer(Boxer1, "~r~You lost", 3500, 1);
								format(string, sizeof(string), "Вы выиграли борьбу против %s.", loser);
								SendClientMessage(Boxer2, COLOR_LIGHTBLUE, string);
								GameTextForPlayer(Boxer2, "~r~You won", 3500, 1);
                                GameTextForPlayer(Boxer1, "~g~Match Over", 5000, 1); GameTextForPlayer(Boxer2, "~g~Match Over", 5000, 1);
                                PlayerBoxing[Boxer1] = 0;
								PlayerBoxing[Boxer2] = 0;
							}
			            }
			            else if(Lost == 2)
			            {
			                if(IsPlayerConnected(Boxer1) && IsPlayerConnected(Boxer2))
			                {
					        	SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186); SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
					        	SetPlayerInterior(Boxer1, 5); SetPlayerInterior(Boxer2, 5);
			                	GetPlayerName(Boxer1, winner, sizeof(winner));
			                	GetPlayerName(Boxer2, loser, sizeof(loser));
			                	if(TBoxer < 255)
			                	{
			                	    if(IsPlayerConnected(TBoxer))
			                	    {
				                	    if(TBoxer != Boxer1)
				                	    {
				                	        if(PlayerInfo[Boxer1][pJob] == 10)
				                	        {
					                	        TBoxer = Boxer1;
					                	        GetPlayerName(TBoxer, titel, sizeof(titel));
					                	        new nstring[MAX_PLAYER_NAME];
												format(nstring, sizeof(nstring), "%s", titel);
												strmid(Titel[TitelName], nstring, 0, strlen(nstring), 255);
					                	        Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
					                	        Titel[TitelLoses] = PlayerInfo[TBoxer][pLoses];
					                	        SaveBoxer();
											}
										}
										else
										{
										    GetPlayerName(TBoxer, titel, sizeof(titel));
											Titel[TitelWins] = PlayerInfo[TBoxer][pWins];
				                	        Titel[TitelLoses] = PlayerInfo[Boxer1][pLoses];
				                	        SaveBoxer();
										}
									}
								}//TBoxer
								format(string, sizeof(string), "Вы проиграли борьбу против %s.", winner);
								SendClientMessage(Boxer1, COLOR_LIGHTBLUE, string);
								GameTextForPlayer(Boxer1, "~r~You lost", 3500, 1);
								format(string, sizeof(string), "Вы выиграли борьбу против %s.", loser);
								SendClientMessage(Boxer2, COLOR_LIGHTBLUE, string);
								GameTextForPlayer(Boxer2, "~r~You won", 3500, 1);
                                GameTextForPlayer(Boxer1, "~g~Match Over", 5000, 1); GameTextForPlayer(Boxer2, "~g~Match Over", 5000, 1);
                                PlayerBoxing[Boxer1] = 0;
								PlayerBoxing[Boxer2] = 0;
							}
			            }
			            InRing = 0;
			            RoundStarted = 0;
			            Boxer1 = 255;
			            Boxer2 = 255;
			            TBoxer = 255;
			            trigger = 0;
			        }
			    }
			}
В конце мода добавим public
PHP:
public SaveBoxer()
{
	new coordsstring[256];
	format(coordsstring, sizeof(coordsstring), "%d,%s,%d", Titel[TitelWins],Titel[TitelName],Titel[TitelLoses]);
	new File: file2 = fopen("boxer.ini", io_write);
	fwrite(file2, coordsstring);
	fclose(file2);
	return 1;
}
Добавим в public OnPlayerCommandText(playerid, cmdtext[])
PHP:
   if(strcmp(cmd, "/fight", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(InRing > 0)return SendClientMessage(playerid, COLOR_GREY, "Вы уже приняли бой!");
	        if(PlayerBoxing[playerid] > 0)return SendClientMessage(playerid, COLOR_GREY, "Вы уже боритесь");
	        if(!PlayerToPoint(20.0,playerid,765.9343,0.2761,1000.7173))return SendClientMessage(playerid, COLOR_GREY, "Вы не в спортзале!");
	        tmp = strtok(cmdtext, idx);
			if(!strlen(tmp)) {
				SendClientMessage(playerid, COLOR_WHITE, "{DDA0DD} >> Введите{FFFFFF}: /fight [id]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
		    if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        if (ProxDetectorS(8.0, playerid, giveplayerid))
					{
					    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Вы не можете вызвать на бой самого себя!"); return 1; }
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "Вы предложили бой %s.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), " %s предлагает вам бой ((/accept fight)) чтобы принять.", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
				        BoxOffer[giveplayerid] = playerid;
					}
					else return SendClientMessage(playerid, COLOR_GREY, "Игрок не возле вас!");
			    }
			}
			else return SendClientMessage(playerid, COLOR_GREY, "Игрок не в сети!");
	    }
	    return 1;
	}
Теперь добавим в public OnPlayerPickUpPickup(playerid, pickupid)
PHP:
if(pickupid == sporthelp)
    {
		    new rabotadialog[2148];
	            format(rabotadialog,sizeof(rabotadialog), "%s%s%s%s%s%s%s%s%s%s%s%s",
		    sportMSG[0],sportMSG[1],sportMSG[2],sportMSG[3],sportMSG[4],sportMSG[5],sportMSG[6],sportMSG[7],sportMSG[8],sportMSG[9],sportMSG[10],sportMSG[11]);
		    ShowPlayerDialog(playerid,133,DIALOG_STYLE_MSGBOX,"Информация", rabotadialog, "Ок", "");
    }
    if(pickupid == boxform)
	{
       ShowPlayerDialog(playerid,408,DIALOG_STYLE_MSGBOX,"Выбор","В какую одежду вы хотите переодеться?","Спорт","Обычный");
	}
Теперь в public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) добавим
PHP:
		case 408:
        {
        if(response)
        {
       		if(boxforma[playerid] == 1)return SendClientMessage(playerid,0xFFFFFFFF,"Вы уже в спортивной форме");
		    OldSkin[playerid] = GetPlayerSkin(playerid);
		    boxforma[playerid] = 1;
			SetPlayerSkin(playerid,80);
			if(PlayerInfo[playerid][pSex] == 2)
			{
			SetPlayerSkin(playerid,41);
			}
		   return 1;
        }
        else
        {
    	if(boxforma[playerid] == 0)return SendClientMessage(playerid,0xFFFFFFFF,"Вы в своей одежде");
		    boxforma[playerid] = 0;
		    SetPlayerSkin(playerid, OldSkin[playerid]);
		return 1;
        }
    }
Добавим пикапы и 3D текст
PHP:
sporthelp = CreatePickup(1239,23,773.8960,5.2577,1000.7802);
    boxform = CreatePickup(1275,23,756.4088,6.0036,1000.6992);
    CreatePickup(1314,23,765.3245,10.8755,1000.7081);
    Create3DTextLabel("/fight чтобы начать бой",COLOR_BLUE,765.3245,10.8755,1000.7081,25.0,0,1);
Автор - Не знаю
Вырезал с Rezone-Rp

Если помог ставьте +
 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу