Код:
if(newkeys & KEY_YES && !IsPlayerInAnyVehicle(playerid) && PlayerInfo[playerid][playerteam] != CIV && !IsPlayerFED(playerid)) // take from refinary / vehicle!
{
new carid = GetPlayerNearestVehicle(playerid);
new vehicleid = FindVehicleID(carid);
new model = GetVehicleModel(carid);
if(IsPlayerInRangeOfPoint(playerid, 3.0, 679.9108, 826.1727, -38.9921)) // getting metal - quarry
{
if(GetPVarInt(playerid, "TakingFromMetal") != 0) return SendClientError(playerid, "You're already carrying metal.");
if(GetPVarInt(playerid, "TakingFromLead") != 0) return SendClientError(playerid, "You cannot carry metal and lead at the same time.");
SetPVarInt(playerid, "TakingFromMetal", 1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
SendClientMessage(playerid, COLOR_LIGHTGREY, "* You are currently carrying a crate with 25 metal pieces.");
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0, -1520.6732,116.4880,17.3281)) // getting lead - ship
{
if(GetPVarInt(playerid, "TakingFromMetal") != 0) return SendClientError(playerid, "You cannot carry metal and lead at the same time.");
if(GetPVarInt(playerid, "TakingFromLead") != 0) return SendClientError(playerid, "You're already carrying lead.");
SetPVarInt(playerid, "TakingFromLead", 1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
SendClientMessage(playerid, COLOR_LIGHTGREY, "* You are currently carrying a crate with 25 lead pieces.");
}
else if(GetDistanceFromPlayerToVehicle(playerid, vehicleid) < 5.1) // take from vehicle
{
if(model == 591 || model == 435 && VehicleInfo[vehicleid][vReserved] == VEH_TYPE_WH_TRAILER) // making sure it's made for warehouses...
{
if(GetPVarInt(playerid, "TakingFromMetal") == 0 && GetPVarInt(playerid, "TakingFromLead") == 0 && GetPVarInt(playerid, "StoringLeadToWareHouse") == 0 && GetPVarInt(playerid, "StoringMetalToWareHouse") == 0)
{
if(VehicleInfo[vehicleid][vWHMetal] != 0 && VehicleInfo[vehicleid][vWHLead] == 0) // vehicle has metal
{
SetPVarInt(playerid, "StoringMetalToWareHouse", 1);
VehicleInfo[vehicleid][vWHMetal] -= 25;
Action(playerid, "takes a crate of metal from the back of the trailer.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
}
else if(VehicleInfo[vehicleid][vWHLead] != 0 && VehicleInfo[vehicleid][vWHMetal] == 0) // vehicle has lead
{
SetPVarInt(playerid, "StoringLeadToWareHouse", 1);
VehicleInfo[vehicleid][vWHLead] -= 25;
Action(playerid, "takes a crate of lead from the back of the trailer.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
}
}
}
}
}
if(newkeys & KEY_NO && !IsPlayerInAnyVehicle(playerid) && PlayerInfo[playerid][playerteam] != CIV && !IsPlayerFED(playerid))
{
new carid = GetPlayerNearestVehicle(playerid);
new vehicleid = FindVehicleID(carid);
new model = GetVehicleModel(carid);
if(GetDistanceFromPlayerToVehicle(playerid, vehicleid) < 5.1) // load / metal lead to the vehicle!
{
if(model == 591 || model == 435 && VehicleInfo[vehicleid][vReserved] == VEH_TYPE_WH_TRAILER) // let's make sure it's able to load...
{
if(GetPVarInt(playerid, "TakingFromLead") == 1 || GetPVarInt(playerid, "StoringLeadToWareHouse") == 1) // store lead to vehicle
{
if(VehicleInfo[vehicleid][vWHMetal] != 0) return SendClientError(playerid, "You cannot store both metal and lead inside this trailer.");
if(VehicleInfo[vehicleid][vWHLead] >= 100000) return SendClientError(playerid, "This trailer cannot hold more than 100,000 lead pieces.");
DeletePVar(playerid, "TakingFromLead");
DeletePVar(playerid, "StoringLeadToWareHouse");
VehicleInfo[vehicleid][vWHLead] += 25;
SendClientMessage(playerid, COLOR_LIGHTGREY, "* You have stored 25 lead pieces in to this vehicle.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
else if(GetPVarInt(playerid, "TakingFromMetal") == 1 || GetPVarInt(playerid, "StoringMetalToWareHouse") == 1) // store metal to vehicle
{
if(VehicleInfo[vehicleid][vWHLead] != 0) return SendClientError(playerid, "You cannot store both metal and lead inside this trailer.");
if(VehicleInfo[vehicleid][vWHMetal] >= 100000) return SendClientError(playerid, "This trailer cannot hold more than 100,000 metal pieces.");
DeletePVar(playerid, "TakingFromMetal");
DeletePVar(playerid, "StoringMetalToWareHouse");
VehicleInfo[vehicleid][vWHMetal] += 25;
SendClientMessage(playerid, COLOR_LIGHTGREY, "* You have stored 25 metal pieces in to this vehicle.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
}
}
else if(IsPlayerOutWarehouse(playerid) != -1) // warehouse load
{
new whID = IsPlayerOutWarehouse(playerid);
if(GetPVarInt(playerid, "TakingFromLead") == 1 || GetPVarInt(playerid, "StoringLeadToWareHouse") == 1) // store lead to warehouse
{
if(WareHouseInfo[whID][whOpen] == false) return SendClientError(playerid, "This warehouse is currently locked.");
SendClientMessage(playerid, COLOR_LIGHTGREY, "* You have deposited 25 lead pieces in to the warehouse.");
DeletePVar(playerid, "TakingFromLead");
DeletePVar(playerid, "StoringLeadToWareHouse");
WareHouseInfo[whID][whLead] += 25;
ReloadFaction(whID, true);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
else if(GetPVarInt(playerid, "TakingFromMetal") == 1 || GetPVarInt(playerid, "StoringMetalToWareHouse") == 1) // store metal to warehouse
{
if(WareHouseInfo[whID][whOpen] == false) return SendClientError(playerid, "This warehouse is currently locked.");
SendClientMessage(playerid, COLOR_LIGHTGREY, "* You have deposited 25 metal pieces in to the warehouse.");
DeletePVar(playerid, "TakingFromMetal");
DeletePVar(playerid, "StoringMetalToWareHouse");
WareHouseInfo[whID][whMetal] += 25;
ReloadFaction(whID, true);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
}
}