Parya
Компетентный
Не закупаются проды в фургон.Код:
if(strcmp(cmd, "/buyprods", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
new compcost = 50;
if(IsPlayerInRangeOfPoint(playerid,60, 2787.8,-2436.3,13.7) || IsPlayerInRangeOfPoint(playerid,60,-54.7880,-1139.0099,1.0781))
{
if(IsATruck(tmpcar))
{
if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "{00CC00}[Ïîäñêàçêà]{FFFFFF}: /buyprods [çíà÷åíèå]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_RED, "Íåëüçÿ êóïèòü ìåíåå îäíîãî êîìïîíåíòà è íå áîëåå 500."); return 1; }
new check= PlayerHaul[tmpcar][pLoad] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), "Ëèìèò ãðóçà êîìïîíåíòîâ äëÿ ãðóçîâèêà %d, âû ïåðåãðóæåíû %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pLoad] += amount;
format(string, sizeof(string), "Ïðîäóêöèÿ: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "Âû êóïèëè %d ïðîäóêöèÿ äëÿ $%d.", amount,cost);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
GivePlayerMoney(playerid,-cost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
else
{
format(string, sizeof(string), "Âû ïðåäîñòàâëÿåòå %d ïðîäóêöèþ íà $%d .", amount,cost);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Ïðîäóêöèÿ: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED , "Ýòîò òðàíñïîðò íå ìîæåò ïåðåâîçèòü ïðîäóêöèþ.");
return 1;
}
}
}
return 1;
}
if(strcmp(cmd, "/buyprods", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
new compcost = 50;
if(IsPlayerInRangeOfPoint(playerid,60, 2787.8,-2436.3,13.7) || IsPlayerInRangeOfPoint(playerid,60,-54.7880,-1139.0099,1.0781))
{
if(IsATruck(tmpcar))
{
if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "{00CC00}[Ïîäñêàçêà]{FFFFFF}: /buyprods [çíà÷åíèå]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_RED, "Íåëüçÿ êóïèòü ìåíåå îäíîãî êîìïîíåíòà è íå áîëåå 500."); return 1; }
new check= PlayerHaul[tmpcar][pLoad] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), "Ëèìèò ãðóçà êîìïîíåíòîâ äëÿ ãðóçîâèêà %d, âû ïåðåãðóæåíû %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pLoad] += amount;
format(string, sizeof(string), "Ïðîäóêöèÿ: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "Âû êóïèëè %d ïðîäóêöèÿ äëÿ $%d.", amount,cost);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
GivePlayerMoney(playerid,-cost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
else
{
format(string, sizeof(string), "Âû ïðåäîñòàâëÿåòå %d ïðîäóêöèþ íà $%d .", amount,cost);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Ïðîäóêöèÿ: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED , "Ýòîò òðàíñïîðò íå ìîæåò ïåðåâîçèòü ïðîäóêöèþ.");
return 1;
}
}
}
return 1;
}
