PHP код:
if(pickupid == FermPickup[2] || pickupid == FermPickup[3])
{
for(new f = 0; f < sizeof(FermInfo); f++)
{
if(PlayerKist[playerid] == true)
{
new pID = GetFarmPickup(pickupid);
if(FermInfo[f][fNytriCar][pID] > 1000)//Если в машине меньше 1000 зерен то...
{
new string[30+MAX_PLAYER_NAME-2];
FermInfo[f][fNytriCar][pID] = 1000;
SendClientMessage(playerid, COLOR_WHITE, "Грузовик полон!");
static const ferm_1[] = "Загруженно\n{ffffff}%d / 1000";
format(string, sizeof(string), ferm_1, FermInfo[f][fNytriCar][pID]);
DisablePlayerCheckpoint(playerid);
if(IsPlayerAttachedObjectSlotUsed(playerid, 3)) RemovePlayerAttachedObject(playerid, 3);
PlayerKist[playerid] = false;
}
else
{
new string[50+MAX_PLAYER_NAME-2];
FermInfo[f][fZaseeno] -= 5;//Отнимаем -5 засеености!
FermInfo[f][fNytriCar][pID] += 5;//Загрузили +5 зерен!
FermZarabotok[1] += FermInfo[f][fPayday];//Прибовляем заработок
static const ferm[] = "~b~count:~w~+%d$";
format(string, sizeof(string), ferm, FermZarabotok[1]);
GameTextForPlayer(playerid, string, 3000, 1);
DisablePlayerCheckpoint(playerid);//Удалили чекпоинт
GetXYInFrontOfPlayer(playerid, X12, Y12, Z12);
SetPlayerCheckpoint(playerid, X12+random(2), Y12+random(2), Z12, 2.0);
if(IsPlayerAttachedObjectSlotUsed(playerid, 3)) RemovePlayerAttachedObject(playerid, 3);
static const ferm_1[] = "Загруженно\n{ffffff}%d / 1000";
format(string, sizeof(string), ferm_1, FermInfo[f][fNytriCar][pID]);
Update3DTextLabelText(FermText3D[pID], COLOR_YELLOW, string);
PlayerKist[playerid] = false;
if(gettime() - GetPVarInt(playerid, "BotFarm") < 20)
{
if(GetPVarInt(playerid, "BotCount") == 1)
{
if(GetPVarInt(playerid, "FludTime") < gettime())
{
static const ferm_2[] = "<<Warning>> Игрок %s[%d]: Возможно бот фермер";
format(string, sizeof(string), ferm_2, PlayerInfo[playerid][pName], playerid);
SendAdminMessage(COLOR_RED, string);
SetPVarInt(playerid, "BotCount", 0);
SetPVarInt(playerid,"FludTime",gettime()+10);
}
}
}
SetPVarInt(playerid, "BotFarm", gettime());
SetPVarInt(playerid, "BotCount", GetPVarInt(playerid, "BotCount") +1);
PlayerCheck[1] = true;
}
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "{00D607} Для начала соберите урожай {FFFFFF}(( Встаньте на красный чекпоинт, и ждите 15 секунд ))");
SendClientMessage(playerid, COLOR_GREEN, "{00D607} Когда соберёте положите в кузов автомобиля {FFFFFF}(( Встаньте на желтую стрелку ))");
SendClientMessage(playerid, COLOR_GREEN, "{00D607} Если захотите завершить работу, пройдите к раздевалке {FFFFFF}(( Встаньте на синий пикап у фермы ))");
SendClientMessage(playerid, COLOR_GREEN, "{00D607} Если вы фермер, то просто сядьте в машину для завершения сбора урожая, /funload - разгрузить урожай");
DisablePlayerCheckpoint(playerid);
if(IsPlayerAttachedObjectSlotUsed(playerid, 3)) RemovePlayerAttachedObject(playerid, 3);
GetXYInFrontOfPlayer(playerid, X12, Y12, Z12);
SetPlayerCheckpoint(playerid, X12+random(2), Y12+random(2), Z12, 2.0);
PlayerKist[playerid] = false;
PlayerCheck[1] = true;
return 1;
}
}
PHP код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
if (IsPlayerInAnyVehicle(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
else
{
GetPlayerFacingAngle(playerid, a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return true;
}