R@W
Умник
в new добовляем
в public OnPlayerPickUpPickup(playerid, pickupid) добовляем:
в 3D тексты кидаем:
Создаём два паблика
Делаем команды:
Вот и всё.
PHP:
new encarier; // Вход в карьер
new excarier; // Выход из карьера
new encarier; // Вход в карьер
new excarier; // Выход из карьера
new Rudabox = 0; // Склад руды
new Materialsbox = 0; // Склад завода
new Bilaz1 = 0;
new Bilaz2 = 0;
new Bilaz3 = 0;
new Bilaz4 = 0;
new Bilaz5 = 0;
new Bilaz6 = 0;
PHP:
else if(pickupid == encarier)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 811.919921,837.891418,9.830896);
}
else if(pickupid == excarier)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 839.547973,857.159484,12.895117);
}
PHP:
Create3DTextLabel( "Работа водителя Билаза\nЧтобы устроится введите /go", 0x008080FF, 835.904968,858.773803,13.5, 40.0, 0 );
encarier = CreatePickup(1318,1,835.898498,854.819152,12.614954); // Вход в карьер
excarier = CreatePickup(1318,1,814.163818,839.041259,10.970828); // Выход из карьера
PHP:
public LoadMaterials()
{
new arrCoords[9][64];
new strFromFile2[256];
new File: file = fopen("materials.ini", io_read);
if (file)
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
Rudabox = strval(arrCoords[0]);
Materialsbox = strval(arrCoords[1]);
Bilaz1 = strval(arrCoords[2]);
Bilaz2 = strval(arrCoords[3]);
Bilaz3 = strval(arrCoords[4]);
Bilaz4 = strval(arrCoords[5]);
Bilaz5 = strval(arrCoords[6]);
Bilaz6 = strval(arrCoords[7]);
fclose(file);
}
return 1;
}
public SaveMaterials()
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%d|%d|%d|%d|%d|%d|%d", Rudabox, Materialsbox, Bilaz1, Bilaz2, Bilaz3, Bilaz4, Bilaz5, Bilaz6);
new File: file2 = fopen("materials.ini", io_write);
fwrite(file2, coordsstring);
fclose(file2);
return 1;
}
PHP:
if(strcmp(cmd, "/loadruda", true) == 0)// Узнать кол-ко руды на складе
{
if(PlayerInfo[playerid][pJob] != 22 )
{
SendClientMessage(playerid, COLOR_GREY, "Доступ имеют только водители Билазов!");
return 1;
}
if (PlayerToPoint(8.0, playerid,804.801,842.090,10.732)) {}
else { SendClientMessage(playerid, COLOR_RED, "Вы не около склада складе!"); return 1; }
format(string, sizeof(string), "Количество руды на складе: %d из 50000!", Rudabox);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(strcmp(cmd, "/ruda", true) == 0)// Загрузить руду в грузовик
{
if(PlayerInfo[playerid][pJob] != 22)
{
SendClientMessage(playerid, COLOR_GREY, "Доступ имеют только водители Билазов!");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
if(newcar == bilo1 || newcar == bilo2 || newcar == bilo3 || newcar == bilo4 || newcar == bilo5 || newcar == bilo6)
{} else { SendClientMessage(playerid, COLOR_GREY, "Вы не в Билазе"); return 1; }
if(newcar == bilo1)
{
if(Bilaz1 == 100)
{
SendClientMessage(playerid, COLOR_GREY, "Машина уже загружена, едьте на склад!");
SetPlayerCheckpoint(playerid, 804.801,842.090,10.732, 8.0);
return 1;
}
}
if(newcar == 454)
{
if(Bilaz2 == bilo2)
{
SendClientMessage(playerid, COLOR_GREY, "Машина уже загружена, едьте на склад!");
SetPlayerCheckpoint(playerid, 804.801,842.090,10.732, 8.0);
return 1;
}
}
if(newcar == bilo3)
{
if(Bilaz3 == 100)
{
SendClientMessage(playerid, COLOR_GREY, "Машина уже загружена, едьте на склад!");
SetPlayerCheckpoint(playerid, 804.801,842.090,10.732, 8.0);
return 1;
}
}
if(newcar == bilo4)
{
if(Bilaz4 == 100)
{
SendClientMessage(playerid, COLOR_GREY, "Машина уже загружена, едьте на склад!");
SetPlayerCheckpoint(playerid, 804.801,842.090,10.732, 8.0);
return 1;
}
}
if(newcar == bilo5)
{
if(Bilaz5 == 100)
{
SendClientMessage(playerid, COLOR_GREY, "Машина уже загружена, едьте на склад!");
SetPlayerCheckpoint(playerid, 804.801,842.090,10.732, 8.0);
return 1;
}
}
if(newcar == bilo6)
{
if(Bilaz6 == 100)
{
SendClientMessage(playerid, COLOR_GREY, "Машина уже загружена, едьте на склад!");
SetPlayerCheckpoint(playerid, 804.801,842.090,10.732, 8.0);
return 1;
}
}
SendClientMessage(playerid, COLOR_WHITE, "Следуйте к месту погрузки руды.");
if(rudaslots == 1)
{
SetPlayerCheckpoint(playerid, 599.036,932.729,-40.953, 8.0);
rudaslots += 1;
}
else if(rudaslots == 2)
{
SetPlayerCheckpoint(playerid, 556.766,923.956,-42.960, 8.0);
rudaslots += 1;
}
else if(rudaslots == 3)
{
SetPlayerCheckpoint(playerid, 576.121,871.943,-43.616, 8.0);
rudaslots += 1;
}
else if(rudaslots == 4)
{
SetPlayerCheckpoint(playerid, 551.299,878.674,-42.683, 8.0);
rudaslots += 1;
}
else if(rudaslots == 5)
{
SetPlayerCheckpoint(playerid, 540.563,844.478,-41.794, 8.0);
rudaslots += 1;
}
else if(rudaslots == 6)
{
SetPlayerCheckpoint(playerid, 585.906,844.187,-42.469, 8.0);
rudaslots = 1;
}
return 1;
}
if(strcmp(cmd, "/takeruda", true) == 0)
{
if(PlayerInfo[playerid][pJob] != 22)
{
SendClientMessage(playerid, COLOR_GREY, "Доступ имеют только водители Билазов!");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
if(newcar == bilo1 || newcar == bilo2 || newcar == bilo3 || newcar == bilo4 || newcar == bilo5 || newcar == bilo6)
{} else { SendClientMessage(playerid, COLOR_GREY, "Вы не в Билазе"); return 1; }
if(IsPlayerInCheckpoint(playerid)) {}
else { SendClientMessage(playerid, COLOR_RED, "Вы не на месте погрузки руды!"); return 1; }
if (PlayerToPoint(8.0, playerid,599.036,932.729,-40.953) || PlayerToPoint(8.0, playerid,556.766,923.956,-42.960) || PlayerToPoint(8.0, playerid,576.121,871.943,-43.616) || PlayerToPoint(8.0, playerid,551.299,878.674,-42.683) || PlayerToPoint(8.0, playerid,540.563,844.478,-41.794) || PlayerToPoint(8.0, playerid,585.906,844.187,-42.469))
{}
else
{
SendClientMessage(playerid, COLOR_RED, "Вы не на месте погрузки руды!");
return 1;
}
SendClientMessage(playerid, COLOR_WHITE, "Началась погрузка руды. Подождите 2 минуты!");
TogglePlayerControllable(playerid,0);
DisablePlayerCheckpoint(playerid);
SetTimerEx("ruda", 120000, 0, "d", playerid);
return 1;
}
if(strcmp(cmd, "/sellruda", true) == 0)// Сдать руду на склад
{
if(PlayerInfo[playerid][pJob] != 22)
{
SendClientMessage(playerid, COLOR_GREY, "Доступ имеют только водители Билазов!");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
if(newcar == bilo1 || newcar == bilo2 || newcar == bilo3 || newcar == bilo4 || newcar == bilo5 || newcar == bilo6)
{} else { SendClientMessage(playerid, COLOR_GREY, "Вы не в Билазе"); return 1; }
if(IsPlayerInCheckpoint(playerid)) {}
else { SendClientMessage(playerid, COLOR_RED, "Вы не возле склада!"); return 1; }
if (PlayerToPoint(8.0, playerid,804.801,842.090,10.732)) {}
else { SendClientMessage(playerid, COLOR_RED, "Вы не возле склада!"); return 1; }
if (Rudabox >= 50000)
{
SendClientMessage(playerid, COLOR_RED, "Извените, склад полон. Попробуйте позже!"); return 1;
}
if(newcar == bilo1)
{ Bilaz1 = 0; }
if(newcar == bilo2)
{ Bilaz2 = 0; }
if(newcar == bilo3)
{ Bilaz3 = 0; }
if(newcar == bilo4)
{ Bilaz4 = 0; }
if(newcar == bilo5)
{ Bilaz5 = 0; }
if(newcar == bilo6)
{ Bilaz6 = 0; }
SendClientMessage(playerid, COLOR_RED, "Доставлено, вы заработали $5000!");
Rudabox +=100;
new sellmoney = 5000;
GivePlayerMoney(playerid, sellmoney);
DisablePlayerCheckpoint(playerid);
SaveMaterials();
return 1;
}
if(strcmp(cmd,"/mats",true)==0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "..::Virtual City::..: Используйте: /mats [название]");
SendClientMessage(playerid, COLOR_WHITE, "Используйте: buy, sell, load.");
return 1;
}
if(strcmp(x_nr,"buy",true) == 0) // покупка
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(5.0, playerid, 321.816741,916.144958,22.131235))//Координаты покупки
{
SendClientMessage(playerid, COLOR_GREY, "Вы не на месте покупки материалов");//
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "..::Virtual City::..: Используйте: /mats buy [количество]");//
return 1;
}
mammount = strval(tmp);
if(mammount < 1 || mammount > 100)// Диапазон покупки
{
SendClientMessage(playerid, COLOR_GREY, "Покупка материалов не должна превышать в 100 штук.");
return 1;
}
if(GetPlayerMoney(playerid) < mammount * 50)// Кол-во материалов умножаем на 50, это и будет оплата за маты + проверка на наличные
{
SendClientMessage(playerid, COLOR_GREY, "У вас не хватает наличных.");
return 1;
}
if(Rudabox < mammount)
{
SendClientMessage(playerid, COLOR_GREY, "На складе недостаточно заготовок.");
return 1;
}
palammm[playerid] = mammount;
format(string, sizeof(string), "Вы купили %d заготовок за %d$ !", palammm[playerid], mammount * 50);
SendClientMessage(playerid, COLOR_GREY, string);
GivePlayerMoney(playerid, - mammount * 50);
Rudabox -= palammm[playerid];
SaveMaterials();
}
}
else if(strcmp(x_nr,"sell",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(5.0, playerid, 89.951538,-311.614837,1.381098))
{
SendClientMessage(playerid, COLOR_GREY, "Вы не на оптовой базе.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "..::Virtual City::..: Используйте: /mats sell [количество]");
return 1;
}
if (Materialsbox >= 50000)
{
SendClientMessage(playerid, COLOR_GREY, "Приём материалов окончен, база полна!");
return 1;
}
else
{
new sellprice = (100)*(palammm[playerid]); // Цена на продажу
format(string, sizeof(string), "Вы продали %d заготовок за %d$!", palammm[playerid], sellprice);
SendClientMessage(playerid, COLOR_GREY, string);
GivePlayerMoney(playerid, (100)*(palammm[playerid]));
Materialsbox += palammm[playerid];
palammm[playerid] = 0;
SaveMaterials();
}
}
}
else if(strcmp(x_nr,"load",true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(10.0, playerid, 89.951538,-311.614837,1.381098))
{
SendClientMessage(playerid, COLOR_GREY, "Вы не на складе");
return 1;
}
format(string, sizeof(string), "На складе %d/50000 материалов", Materialsbox);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
}
if(strcmp(cmd,"/materials",true)==0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pJob] != 13)
{
SendClientMessage(playerid,COLOR_RED,"** Вы не торговец оружием !");
return 1;
}
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_ISPOLZUY, "*Используйте: /materials [название]");
SendClientMessage(playerid, COLOR_WHITE, " Название: get (купить маты), deliver (обменять маты)");
return 1;
}
if(strcmp(x_nr,"get",true) == 0)
{
if(PlayerToPoint(3.0,playerid,597.1277,-1248.6479,18.2734))
{
new tel;
if(MatsHolding[playerid] > 120)
{
format(string, sizeof(string), " У вас уже есть %d пакетов с материалами с собой, сначала продайте их!", MatsHolding[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ISPOLZUY, " Использовать: /materials get [число]");
return 1;
}
moneys = strval(tmp);
new level = PlayerInfo[playerid][pGunSkill];
if(level >= 0 && level <= 50)
{
tel = 200;
if(moneys < 1 || moneys > 20)
{
SendClientMessage(playerid, COLOR_RED, " Вы не можете покупать меньше 1 или больше 20 на вашем уровне умения!");
return 1;
}
}
else if(level >= 51 && level <= 100)
{
tel = 150;
if(moneys < 1 || moneys > 50)
{
SendClientMessage(playerid, COLOR_RED, " Вы не можете покупать меньше 1 или больше 50 на вашем уровне умения!");
return 1;
}
}
else if(level >= 101 && level <= 200)
{
tel = 100;
if(moneys < 1 || moneys > 80)
{
SendClientMessage(playerid, COLOR_RED, " Вы не можете покупать меньше 1 или больше 80 на вашем уровне умения!");
return 1;
}
}
else if(level >= 201 && level <= 400)
{
tel = 50;
if(moneys < 1 || moneys > 110)
{
SendClientMessage(playerid, COLOR_RED, " Вы не можете покупать меньше 1 или больше 110 на вашем уровне умения!");
return 1;
}
}
new price = moneys * tel;
if(GetPlayerMoney(playerid) > price)
{
format(string, sizeof(string), " Вы купили %d пакетов материалов за $%d.", moneys, price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoney(playerid, - price);
//karman[playerid]-=price;
//TextUpdate(playerid);
MatsHolding[playerid] += moneys;
}
else
{
format(string, sizeof(string), " У вас нет $%d !", price);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, " Вы не в здание покупки пакетов материалов в Лос Сантосе !");
return 1;
}
}
//------------------------------------------------------------------------------
else if(strcmp(x_nr,"deliver",true) == 0)
{
if(PlayerToPoint(3.0,playerid,49.759590,-224.803787,1.776501))
{
if (Materialsbox > 0)
{
if(MatsHolding[playerid] > 0)
{
new payout = (50)*(MatsHolding[playerid]);
format(string, sizeof(string), "* Фабрика дала вам %d материалов за ваши %d пакетов.", payout, MatsHolding[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pMats] += payout;
Materialsbox -= payout;
MatsHolding[playerid] = 0;
}
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;
}
Последнее редактирование модератором:
