Доступ к архиву

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

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

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

Поставка оружейных заготовок на сервер

Статус
В этой теме нельзя размещать новые ответы.
Здравствуйте,форумчани павно.
Коротко о том что я хочу вам предложить:
Предлогаю систему с помощью которой определенная фракция поставляет всему серверу(в частности относиться к работе Гандилера) оружейные заготовки с помощью который Гандилер сможет перерабатывать оружие...Чтож приступим:

ко всем New добавим:
PHP:
new formfuramatbi1 = 0; 
new formfuramatbi2 = 0;
new formfuramatbi3 = 0;
new formfuramatbi4 = 0;
new formfuramatbi5 = 0;

new MatsHolding[MAX_PLAYERS];
new Text3D: form3D;
new formi;

new furaform1; //сами формавозки
new furaform2;
new furaform3;
new furaform4;
new furaform5;

new formmatbi = 1000000; //отвечает за кол-во сколько влезит в склад
В паблик
PHP:
public OnPlayerStateChange(playerid, newstate, oldstate)
добавим
PHP:
    if(newcar == furaform1) //kar
    {
		if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
		{
			format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi1);
			SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "Для загрузки оружейных заготовок используйте /buyform /sellform");
		}
		else
		{
			SendClientMessage(playerid,COLOR_GREY,"Вы не состоите в Rifa");
			RemovePlayerFromVehicle(playerid);
			return 1;
		}
	}
	if(newcar == furaform2) //kar
	{
		if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
		{
			format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi2);
			SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "Для загрузки оружейных заготовок используйте /buyform /sellform");
		}
		else
		{
			SendClientMessage(playerid,COLOR_GREY,"Вы не состоите в Rifa");
			RemovePlayerFromVehicle(playerid);
			return 1;
		}
	}
	if(newcar == furaform3) //kar
	{
		if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
		{
			format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi3);
			SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "Для загрузки оружейных заготовок используйте /buyform /sellform");
		}
		else
		{
			SendClientMessage(playerid,COLOR_GREY,"Вы не состоите в Rifa");
			RemovePlayerFromVehicle(playerid);
			return 1;
		}
	}
	if(newcar == furaform4) //kar
	{
		if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
		{
			format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi4);
			SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "Для загрузки оружейных заготовок используйте /buyform /sellform");
		}
		else
		{
			SendClientMessage(playerid,COLOR_GREY,"Вы не состоите в Rifa");
			RemovePlayerFromVehicle(playerid);
			return 1;
		}
	}
	if(newcar == furaform5) //kar
	{
		if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
		{
			format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi5);
			SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "Для загрузки оружейных заготовок используйте /buyform /sellform");
		}
		else
		{
			SendClientMessage(playerid,COLOR_GREY,"Вы не состоите в Rifa");
			RemovePlayerFromVehicle(playerid);
			return 1;
		}
    }
затем нам понадобиться создать сами команды для покупки и разгрузки заготовок
в
PHP:
public OnPlayerCommandText(playerid, cmdtext[])
{
добавляем
PHP:
    if(strcmp(cmd, "/buyform",true)==0)
	{
		if(PlayerToPoint(15,playerid,2259.5771,-2256.0471,13.5469))
		{
			if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
			{
				if(formfuramatbi1 < 20)
				{
					if(IsPlayerInVehicle(playerid,furaform1))
					{
						GetPlayerName(playerid, string, sizeof(string));
						format(string, sizeof(string), "%s загружает оружейные заготовки", string);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
						SendClientMessage(playerid,COLOR_PURPLE,"оружейные заготовки загружены");
						formfuramatbi1 += 20;
						format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi1);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						NormMoney[playerid] = 2;
						AntiMoney[playerid] = AntiMoney[playerid] - 400;
						GameTextForPlayer(playerid, "~r~-400$", 3000, 1);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы купили 20 едениц заготовок за $400");
						return 1;
					}
				}
				if(formfuramatbi2 < 20)
				{
					if(IsPlayerInVehicle(playerid,furaform2))
					{
						GetPlayerName(playerid, string, sizeof(string));
						format(string, sizeof(string), "%s загружает оружейные заготовки", string);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
						SendClientMessage(playerid,COLOR_PURPLE,"оружейные заготовки загружены");
						formfuramatbi2 += 20;
						format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi2);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						NormMoney[playerid] = 2;
						AntiMoney[playerid] = AntiMoney[playerid] - 400;
						GameTextForPlayer(playerid, "~r~-400$", 3000, 1);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы купили 20 едениц заготовок за $400");
						return 1;
					}
				}
				if(formfuramatbi3 < 20)
				{
					if(IsPlayerInVehicle(playerid,furaform3))
					{
						GetPlayerName(playerid, string, sizeof(string));
						format(string, sizeof(string), "%s загружает оружейные заготовки", string);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
						SendClientMessage(playerid,COLOR_PURPLE,"оружейные заготовки загружены");
						formfuramatbi3 += 20;
						format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi3);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						NormMoney[playerid] = 2;
						AntiMoney[playerid] = AntiMoney[playerid] - 400;
						GameTextForPlayer(playerid, "~r~-400$", 3000, 1);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы купили 20 едениц заготовок за $400");
						return 1;
					}
				}
				if(formfuramatbi4 < 20)
				{
					if(IsPlayerInVehicle(playerid,furaform4))
					{
						GetPlayerName(playerid, string, sizeof(string));
						format(string, sizeof(string), "%s загружает оружейные заготовки", string);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
						SendClientMessage(playerid,COLOR_PURPLE,"оружейные заготовки загружены");
						formfuramatbi4 += 20;
						format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi4);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						NormMoney[playerid] = 2;
						AntiMoney[playerid] = AntiMoney[playerid] - 400;
						GameTextForPlayer(playerid, "~r~-400$", 3000, 1);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы купили 20 едениц заготовок за $400");
						return 1;
					}
				}
				if(formfuramatbi5 < 20)
				{
					if(IsPlayerInVehicle(playerid,furaform5))
					{
						GetPlayerName(playerid, string, sizeof(string));
						format(string, sizeof(string), "%s загружает оружейные заготовки", string);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
						SendClientMessage(playerid,COLOR_PURPLE,"оружейные заготовки загружены");
						formfuramatbi5 += 20;
						format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi5);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						NormMoney[playerid] = 2;
						AntiMoney[playerid] = AntiMoney[playerid] - 400;
						GameTextForPlayer(playerid, "~r~-400$", 3000, 1);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы купили 20 едениц заготовок за $400");
						return 1;
					}
				}
			}
		}
	}
	if(strcmp(cmd, "/sellform",true)==0)
	{
		if(PlayerToPoint(20,playerid,-2119.6343,-178.1545,35.3203))
		{
			if(formmatbi <= 5000)
			{
				if(IsPlayerInVehicle(playerid,furaform1))
				{
					if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
					{
						if(formfuramatbi1 == 20)
						{
							formfuramatbi1 -= 20;
							formmatbi += 20;
							UpdateDynamic3DTextLabelText(form3D, 0xFFFFFFFF, "");
							SaveForm();
							GetPlayerName(playerid, string, sizeof(string));
							format(string, sizeof(string), "%s Разгружает оружейные заготовки", string);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
							format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi1);
							SendClientMessage(playerid,TEAM_GROVE_COLOR,string);
							NormMoney[playerid] = 2;
							AntiMoney[playerid] = AntiMoney[playerid] + 500;
							GameTextForPlayer(playerid, "~r~+500$", 3000, 1);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы получили 500$ за доставку оружейных заготовок");
							return 1;
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Pusto", 5000, 1);
						}
					}
				}
				if(IsPlayerInVehicle(playerid,furaform2))
				{
					if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
					{
						if(formfuramatbi2 == 20)
						{
							formfuramatbi2 -= 20;
							formmatbi += 20;
							UpdateDynamic3DTextLabelText(form3D, 0xFFFFFFFF, "");
							SaveForm();
							GetPlayerName(playerid, string, sizeof(string));
							format(string, sizeof(string), "%s Разгружает оружейные заготовки", string);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
							format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi2);
							SendClientMessage(playerid,TEAM_GROVE_COLOR,string);
							NormMoney[playerid] = 2;
							AntiMoney[playerid] = AntiMoney[playerid] + 500;
							GameTextForPlayer(playerid, "~r~+500$", 3000, 1);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы получили 500$ за доставку оружейных заготовок");
							return 1;
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Pusto", 5000, 1);
						}
					}
				}
				if(IsPlayerInVehicle(playerid,furaform3))
				{
					if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
					{
						if(formfuramatbi3 == 20)
						{
							formfuramatbi3 -= 20;
							formmatbi += 20;
							UpdateDynamic3DTextLabelText(form3D, 0xFFFFFFFF, "");
							SaveForm();
							GetPlayerName(playerid, string, sizeof(string));
							format(string, sizeof(string), "%s Разгружает оружейные заготовки", string);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
							format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi3);
							SendClientMessage(playerid,TEAM_GROVE_COLOR,string);
							NormMoney[playerid] = 2;
							AntiMoney[playerid] = AntiMoney[playerid] + 500;
							GameTextForPlayer(playerid, "~r~+500$", 3000, 1);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы получили 500$ за доставку оружейных заготовок");
							return 1;
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Pusto", 5000, 1);
						}
					}
				}
				if(IsPlayerInVehicle(playerid,furaform4))
				{
					if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
					{
						if(formfuramatbi4 == 20)
						{
							formfuramatbi4 -= 20;
							formmatbi += 20;
							UpdateDynamic3DTextLabelText(form3D, 0xFFFFFFFF, "");
							SaveForm();
							GetPlayerName(playerid, string, sizeof(string));
							format(string, sizeof(string), "%s Разгружает оружейные заготовки", string);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
							format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi4);
							SendClientMessage(playerid,TEAM_GROVE_COLOR,string);
							NormMoney[playerid] = 2;
							AntiMoney[playerid] = AntiMoney[playerid] + 500;
							GameTextForPlayer(playerid, "~r~+500$", 3000, 1);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы получили 500$ за доставку оружейных заготовок");
							return 1;
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Pusto", 5000, 1);
						}
					}
				}
				if(IsPlayerInVehicle(playerid,furaform5))
				{
					if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
					{
						if(formfuramatbi5 == 20)
						{
							formfuramatbi5 -= 20;
							formmatbi += 20;
							UpdateDynamic3DTextLabelText(form3D, 0xFFFFFFFF, "");
							SaveForm();
							GetPlayerName(playerid, string, sizeof(string));
							format(string, sizeof(string), "%s Разгружает оружейные заготовки", string);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
							format(string, sizeof(string), "Оружейных заготовок: %d/20",formfuramatbi5);
							SendClientMessage(playerid,TEAM_GROVE_COLOR,string);
							NormMoney[playerid] = 2;
							AntiMoney[playerid] = AntiMoney[playerid] + 500;
							GameTextForPlayer(playerid, "~r~+500$", 3000, 1);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, "Вы получили 500$ за доставку оружейных заготовок");
							return 1;
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Pusto", 5000, 1);
						}
					}
				}
			}
		}
	}
Затем нам понадобиться в этот же Паблик добавить команду для Гандилеров
PHP:
    if(strcmp(cmd,"/materials",true)==0)
	{
		if(IsPlayerConnected(playerid))
		{
			if (PlayerInfo[playerid][pJob] != 9) //у меня ид работы Гандилера 9 у вас может быть и другим!!!
			{
				SendClientMessage(playerid,COLOR_GREY,"   Вы не диллер оружия!");
				return 1;
			}
			new x_nr[256];
			x_nr = strtok(cmdtext, idx);
			if(!strlen(x_nr)) {
				SendClientMessage(playerid, COLOR_WHITE, " Используйте: /materials [name]");
				SendClientMessage(playerid, COLOR_WHITE, "Доступные названия: Get, Deliver.");
				return 1;
			}
			if(strcmp(x_nr,"get",true) == 0)
			{
				if(PlayerToPoint(10.0,playerid,597.1277,-1248.6479,18.2734)) //координаты можете поменять на свои см.скрин
				{
					if(MatsHolding[playerid] >= 30)
					{
						SendClientMessage(playerid, COLOR_GREY, " максимум можно взять 30 пакетов!");
						return 1;
					}
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp)) {
						SendClientMessage(playerid, COLOR_WHITE, " используйте: /materials get [ammount]");
						return 1;
					}
					moneys = strval(tmp);
					if(moneys < 30 || moneys > 30) { SendClientMessage(playerid, COLOR_GREY, "* /materials get 30"); return 1; }
					new price = moneys * 10;
					if(GetPlayerMoney(playerid) > price)
					{
						format(string, sizeof(string), "*Вы купили 30 пакетов Материалов 600$");
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						NormMoney[playerid] = 2;
						AntiMoney[playerid] = AntiMoney[playerid] - 600;
						GivePlayerMoney(playerid, -600);
						MatsHolding[playerid] = 1500;
						SBizzInfo[10][sbTill] += 600;
						ExtortionSBiz(10,600);
						OnPlayerUpdate_GF(playerid);//у вас может быть другое сохранение всего!
					}
					else
					{
						format(string, sizeof(string), "   Вы не можете себе предоставить $%d !", price);
						SendClientMessage(playerid, COLOR_GREY, string);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   Вы не у здания покупки материалов в Лос Сантосе!");
					return 1;
				}
			}
			else if(strcmp(x_nr,"deliver",true) == 0)
			{
				if(PlayerToPoint(15.0,playerid,-2116.3979,-77.1027,35.1254))//координаты можете менять на свои см.скрин
				{
					if(MatsHolding[playerid] > 0)
					{
						if(formmatbi >= 16)
						{
						    PlayerInfo[playerid][pMats] += 1500;
							format(string, sizeof(string), "Фабрика выдала вам 1500 материало за ваши 30 пакетов ");
							SendClientMessage(playerid, COLOR_PURPLE, string);
							formmatbi=formmatbi-16;
							MatsHolding[playerid] = 0;
							OnPlayerUpdate_GF(playerid);
							UpdateDynamic3DTextLabelText(form3D, 0xFFFFFFFF, "");
							SaveForm();
						}
						else
						{
							SendClientMessage(playerid,COLOR_GREY,"Фабрика неможет переработать ваши пакеты");
							return 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, " у вас нет пакетов");
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   Вы не на фабрике переработки Рифа");
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   Недействительное название материалов!");
				return 1;
			}
		}
		return 1;
	}
Далее команда для Гандилера на расспростронение оружия в этот же паблик
PHP:
    if(strcmp(cmd,"/sellgun",true)==0)
	{
		if(IsPlayerConnected(playerid))
		{
			if (PlayerInfo[playerid][pJob] != 9) //опять же обращайте внимание у вас возможен другой ид работы ГД
			{
				SendClientMessage(playerid,COLOR_GREY,"   Вы не Гандиллер оружия!");
				return 1;
			}
			new x_weapon[256],weapon[MAX_PLAYERS],ammo[MAX_PLAYERS],price[MAX_PLAYERS];
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, " Используйте: /sellgun [playerid/PartOfName] [weaponname]");
				SendClientMessage(playerid, COLOR_GREY, "оружие: flowers(25) sdpistol(100) eagle(150) mp5(200) shotgun(200)");
				SendClientMessage(playerid, COLOR_GREY, "оружие: ak47(600) m4(600) rifle (600)");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					x_weapon = strtok(cmdtext, idx);
					if(!strlen(x_weapon))
					{
						SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
						SendClientMessage(playerid, COLOR_WHITE, "*** Продажа оружия***");
						SendClientMessage(playerid, COLOR_GREY, "Используйте: /sellgun [playerid/PartOfName] [weaponname]");
						SendClientMessage(playerid, COLOR_GREY, "оружие: flowers(25) sdpistol(100) eagle(200) mp5(200) shotgun(200)");
						SendClientMessage(playerid, COLOR_GREY, "оружие: ak47(600) m4(600) rifle(600)");
						SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
						return 1;
					}
				}
				if(strcmp(x_weapon,"sdpistol",true) == 0) { if(PlayerInfo[playerid][pMats] > 99) { weapon[playerid] = 23; price[playerid] = 100; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 23; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else if(strcmp(x_weapon,"flowers",true) == 0) { if(PlayerInfo[playerid][pMats] > 24) { weapon[playerid] = 14; price[playerid] = 25; ammo[playerid] = 1; PlayerInfo[giveplayerid][pGun1] = 14; PlayerInfo[giveplayerid][pAmmo1] = 1; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else if(strcmp(x_weapon,"eagle",true) == 0) { if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 24; price[playerid] = 150; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 24; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else if(strcmp(x_weapon,"mp5",true) == 0) {	if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 29; price[playerid] = 200; ammo[playerid] = 200; PlayerInfo[giveplayerid][pGun2] = 29; PlayerInfo[giveplayerid][pAmmo2] = 200; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else if(strcmp(x_weapon,"shotgun",true) == 0) {	if(PlayerInfo[playerid][pMats] > 199) { weapon[playerid] = 25; price[playerid] = 200; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 25; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else if(strcmp(x_weapon,"ak47",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 30; price[playerid] = 600; ammo[playerid] = 250; PlayerInfo[giveplayerid][pGun2] = 30; PlayerInfo[giveplayerid][pAmmo2] = 250; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else if(strcmp(x_weapon,"m4",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 31; price[playerid] = 600; ammo[playerid] = 250; PlayerInfo[giveplayerid][pGun2] = 31; PlayerInfo[giveplayerid][pAmmo2] = 250; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else if(strcmp(x_weapon,"rifle",true) == 0) { if(PlayerInfo[playerid][pMats] > 599) { weapon[playerid] = 33; price[playerid] = 600; ammo[playerid] = 50; PlayerInfo[giveplayerid][pGun2] = 33; PlayerInfo[giveplayerid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY,"   недостаточно материалов!"); return 1; } }
				else { SendClientMessage(playerid,COLOR_GREY,"   недействительное название оружия!"); return 1; }
				if (ProxDetectorS(5.0, playerid, giveplayerid))
				{
					if(PlayerInfo[playerid][pMiserPerk] > 0)
					{
						new skill = 2 * PlayerInfo[playerid][pMiserPerk];
						new mats = price[playerid] / 100;
						price[playerid] -= (mats)*(skill);
					}
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "   Вы дали %s, %s с %d боеприпасами, за $ %d ", giveplayer,x_weapon, ammo[playerid], price[playerid]);
					PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
					SendClientMessage(playerid, COLOR_GRAD1, string);
					format(string, sizeof(string), "   Вы получили %s с %d с боеприпасами,от %s.", x_weapon, ammo[playerid], sendername);
					SendClientMessage(giveplayerid, COLOR_GRAD1, string);
					PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
					format(string, sizeof(string), "* %s продаёт оружие %s.", sendername ,giveplayer);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
					ServerGivePlayerWeapons(giveplayerid,weapon[playerid],ammo[playerid]);
					PlayerInfo[playerid][pMats] -= price[playerid];
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD1, "   Вы слишком далеко.");
					return 1;
				}
			}
			else
			{
				format(string, sizeof(string), "   %d не активный игрок.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
добавим в
PHP:
enum pInfo
{
pMats,
Далее в
PHP:
public OnPlayerConnect(playerid)
добавим
PHP:
PlayerInfo[playerid][pMats] = 0;
MatsHolding[playerid] = 0;
в
PHP:
public OnPlayerRegister(playerid, password[])
добавляем
PHP:
iniSetInt(File,"Materials",PlayerInfo[playerid][pMats]);
в
PHP:
public OnPlayerUpdate_GF(playerid)//у вас может и  не так называться
PHP:
iniSetInt(File,"Materials",PlayerInfo[playerid][pMats]);
в
PHP:
public OnPlayerLogin(playerid,password[])
PHP:
iniGetInt(File,"Materials",PlayerInfo[playerid][pMats]);
в
PHP:
public OnGameModeInit()
PHP:
furaform1 = AddStaticVehicleEx(482,-2113.9827,-138.2109,35.4379,319.1937,93,93,300); //
	furaform2 = AddStaticVehicleEx(482,-2113.9800,-132.4041,35.4391,314.8112,93,93,300); //
	furaform3 = AddStaticVehicleEx(482,-2114.0920,-126.6587,35.4425,311.4756,93,93,300); //
	furaform4 = AddStaticVehicleEx(482,-2114.0854,-121.2782,35.4410,314.6689,93,93,300); //
	furaform5 = AddStaticVehicleEx(482,-2114.2014,-115.8122,35.4425,313.1072,93,93,300); //
        LoadForm();
        form3D = CreateDynamic3DTextLabel("Завод материалов(этап2)сейчас на складе: %d едениц",0xBFF600FF,-2116.0493,-77.7953,35.3203,30.0);
        formi= SetTimer("Formm",5000,1);
        CreateDynamic3DTextLabel("Для загрузки используйте /buyform",0xBFF600FF,2259.5771,-2256.0471,13.5469,20.0);
	CreateDynamic3DTextLabel("Рабочие место:Завод материалов",0x008080AA,-2119.6343,-178.1545,35.3203,20.0);
Такс в конец мода добавим
PHP:
forward LoadForm();//haha2
public LoadForm()
{
	new arrCoords[15][64];
	new strFromFile2[256];
	new text[120];
	new File: file = fopen("alkogolj/form.ini", io_read);
	if (file)
	{
		fread(file, strFromFile2);
		split(strFromFile2, arrCoords, ',');
		formmatbi = strval(arrCoords[0]);
		format(text,sizeof(text),"Завод материалов(этап2)сейчас на складе: %d едениц",formmatbi);
		UpdateDynamic3DTextLabelText(form3D, 0xBFF600FF, text);
		fclose(file);
		if(Security == 0 || Security == 1)
		{
		}
		else
		{
			GameModeExit();
		}
	}
	else
	{
		GameModeExit();
	}
	return 1;
}
forward SaveForm(); //haha
public SaveForm()
{
	new coordsstring[128];
	new text[120];
	format(coordsstring, sizeof(coordsstring), "%d", formmatbi);
	new File: file2 = fopen("alkogolj/form.ini", io_write);
	fwrite(file2, coordsstring);
	format(text,sizeof(text),"Завод материалов(этап2)сейчас на складе: %d едениц",formmatbi);
	UpdateDynamic3DTextLabelText(form3D, 0xBFF600FF, text);
	fclose(file2);
	return 1;
}
forward Formm();
public Formm()
{
	new reppp[100];
	format(reppp,sizeof(reppp),"Завод материалов(этап2)сейчас на складе: %d едениц",formmatbi);
	UpdateDynamic3DTextLabelText(form3D, 0xBFF600FF,reppp);
}
в
PHP:
public GameModeExitFunc()
PHP:
KillTimer(formi);
Скрины:




Автор:я

---------- Post added at 07:53 ---------- Previous post was at 07:50 ----------

Если вопросы либо какие-то ошибки пишем,постараюсь помочь!
Простите забыс сразу написать:
в папку scriptfiles нужно добавить папку с названием alkogolj и в неё создайте файл с расширением form.ini и уже после этого в фале form.ini напишите 0
p.s заливать файл нет смысла ,создать быстрее чем скачивать))
 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу