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

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

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

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

Создание чека для канистра бензина

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

Kingston_Farrux

Дебютант
Вот решил сделать свой первый урок исли выйдут ошибки обрашайтесь

Добавляем в public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
php код:
//===============================/CHECKFILL=====================================
if(dialogid == 729)
{
if(response)
{
if(listitem == 0)
{
new lock[128];
switch(SBizzInfo[3][sbLocked])
{
case 0: lock = "Работает";
case 1: lock = "Не работает";
}
new coordsstring[256];
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
format(coordsstring, sizeof(coordsstring),"*** %s ***",SBizzInfo[3][sbMessage]);
SendClientMessage(playerid, COLOR_LIGHTRED,coordsstring);
format(coordsstring, sizeof(coordsstring), "* Работоспособность: %s", lock);
SendClientMessage(playerid, COLOR_WHITE,coordsstring);
format(coordsstring, sizeof(coordsstring), "* Цена на бензин: $%d", SBizzInfo[3][sbEntranceCost]);
SendClientMessage(playerid, COLOR_WHITE,coordsstring);
format(coordsstring, sizeof(coordsstring), "* Цена на чек: 80$, Цена на канистру: 50$");
SendClientMessage(playerid, COLOR_WHITE,coordsstring);
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
}
else if(listitem == 1)
{
ServerGivePlayerMoney(playerid, - 80);
format(string, sizeof(string), "~r~-$%d", 80);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Вы купили чек на заправку автомобиля");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Теперь вы можите сесть в автомобиль и заправить его (/fill)");
SendClientMessage(playerid, COLOR_GRAD4, string);
PlayerInfo[playerid][pCheck] = 1;
SavePlayer(playerid);
}
else if(listitem == 2)
{
ServerGivePlayerMoney(playerid, - 50);
format(string, sizeof(string), "~r~-$%d", 50);
GameTextForPlayer(playerid, string, 5000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Вы купили канистру с бензином (20 литров)");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Теперь вы можите заправить автомобиль автомобиль из канистры (/fillcar)");
SendClientMessage(playerid, COLOR_GRAD4, string);
PlayerInfo[playerid][pFuel] = 20;
SavePlayer(playerid);
}
}
}
Патом в public OnGameModeInit()
php код:
//===================================/CHECKFILL=================================
AddStaticPickup(1239, 2, 1929.0275878906,-1768.7390136719,13.546875); // checkfill
AddStaticPickup(1239, 2, 1007.1081542969,-930.29730224609,42.328125); // checkfill
AddStaticPickup(1239, 2, -79.65357208252,-1171.5675048828,2.1456875801086); // checkfill
AddStaticPickup(1239, 2, -1622.1922607422,-2694.3615722656,48.742660522461); // checkfill
AddStaticPickup(1239, 2, 661.39324951172,-559.32806396484,16.3359375); // Деревня
Create3DTextLabel("/checkfill - купить чек",0x008080FF, 1929.0275878906,-1768.7390136719,14.24687, 40.0, 0, 1);
Create3DTextLabel("/checkfill - купить чек",0x008080FF, 1007.1081542969,-930.29730224609,43.028125, 40.0, 0, 1);
Create3DTextLabel("/checkfill - купить чек",0x008080FF, -79.65357208252,-1171.5675048828,2.8456875801086, 40.0, 0, 1);
Create3DTextLabel("/checkfill - купить чек",0x008080FF, -1622.1922607422,-2694.3615722656,49.542660522461, 40.0, 0, 1);
Create3DTextLabel("/checkfill - купить чек",0x008080FF, 661.39324951172,-559.32806396484,17.0359375, 40.0, 0, 1);
И последняя в public OnPlayerCommandText(playerid, cmdtext[]){
Добавляем php код:
if(strcmp(cmd, "/checkfill", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(2.0, playerid,1929.0275878906,-1768.7390136719,13.546875) || PlayerToPoint(2.0, playerid,1007.1081542969,-930.29730224609,42.328125)
|| PlayerToPoint(2.0, playerid,-79.65357208252,-1171.5675048828,2.1456875801086) || PlayerToPoint(2.0, playerid,-1622.1922607422,-2694.3615722656,48.742660522461)
|| PlayerToPoint(2.0, playerid,661.39324951172,-559.32806396484,16.3359375))
{
ShowPlayerDialog(playerid,729,DIALOG_STYLE_LIST,"Заправка","Посмотреть цены на бензин\nКупить чек на заправку\nКупить конистру с бензином","Ок","Отмена");
}
}
return 1;
}
if(strcmp(cmd, "/fillcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFuel] > 0)
{
if(Gas[gLastCar[playerid]] < 89)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Вы заправили ваш бак на 20% из канистры");
Gas[gLastCar[playerid]] += 20;
PlayerInfo[playerid][pFuel] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "У вас в баке еще достаточно топлива");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Ваша канистра пуста");
}
}
return 1;
}
Скрины:



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