PHP код:
case 5378:
{
if(response)
{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid,COLOR_GREY,"Вы не в автомобиле!");
for(new b = 0; b < sizeof(SBizzInfo); b++) // Зачем?!
{
printf("DEBUG | Вводимый текст = \"%s\"", inputtext);
new Vob = strval(inputtext);
printf("DEBUG | Vob = %d", Vob);
printf("DEBUG | Размер строки = %d", strlen(inputtext));
if(!strlen(inputtext))
return SPD(playerid,5378,DIALOG_STYLE_INPUT,"Заправить","Сколько литров?","Залить","Нет");
if(Vob < 1 || Vob > 100)
{
print(#DEBUG | 1) Проверка выполняться);
SendClientMessage(playerid, COLOR_GREY, "Минимально - 1 л, максимально - 100 л!");
SPD(playerid,5378,DIALOG_STYLE_INPUT,"Заправить","Сколько литров?","Залить","Нет")
return 1;
}
new vehicleid = GetPlayerVehicleID(playerid);
printf("DEBUG | ID cars = %d", vehicleid);
printf("DEBUG | Fuell[vehicleid] = %d", Fuell[vehicleid]);
new Float:benz = 100.0 - Fuell[vehicleid];
printf("DEBUG | Переменная benz = %1.2f", , benz);
printf("DEBUG | floatround(benz) = %d", floatround(benz))
if(Vob > floatround(benz))
{
print(#DEBUG | 2) Проверка выполняться);
SendClientMessage(playerid, COLOR_GREY, "Вы пытаетесь залить больше чем вместится в ваш бак(Max V = 100 л!)");
SPD(playerid,5378,DIALOG_STYLE_INPUT,"Заправить","Сколько литров?","Залить","Нет")
return 1;
}
new cenabenz = SBizzInfo[b][sPrice]*floatround(benz);
printf("DEBUG | cenabenz = %d", cenabenz);
static const msg[] = "Вам не хватает денюжек, стоимость %d вирт";
new str[sizeof(msg) - 2 + 1];
format(str, sizeof(str), msg, cenabenz);
if(PlayerInfo[playerid][pCash] < cenabenz)
return SendClientMessage(playerid, COLOR_GREY, msg);
PlayerInfo[playerid][pCash] -= cenabenz;
SBizzInfo[b][sTill] += cenabenz;
SBizzInfo[b][sBenz] -= Vob;
Fuell[vehicleid] += Vob;
static const msg1[] = "Вы залили %d литров бензина за %d вирт.";
new str1[sizeof(msg) - 4 + 1];
format(str1, sizeof(str1), msg1, Vob,cenabenz);
SendClientMessage(playerid, COLOR_GREY, str1);
}
}
}