Trucker Job Issue
#7

Код:
enum pHaul
{
	pCapasity,
	pLoad,
	pFuelLoad
}

new PlayerHaul[][pHaul];
This code below = On Player State Driver ( When I enter a vehicle the "Fuel: %d,000/%d,000 Gallons" is saying the 1000123812091/100,000 Gallons )
Код:
if(IsAFuelTruck(newcar))//ftjob
		{
		    if(PlayerInfo[playerid][pJob] == 16)
			{
				format(string, sizeof(string), "Fuel: %d,000/%d,000 Gallons", PlayerHaul[newcar][pFuelLoad],PlayerHaul[newcar][pCapasity]);
				SendClientMessage(playerid, COLOR_YELLOW, string);
				SendClientMessage(playerid, COLOR_WHITE, "INFO: You can deliver Fuel to Los Santos Trucking Docks.");
				SendClientMessage(playerid, COLOR_WHITE, "INFO: Commands are /buyfuel [amount] /sellfuel");
			}
			else
			{
   				SendClientMessage(playerid, COLOR_WHITE, "  You are not a Truck Driver.");
			    RemovePlayerFromVehicle(playerid);
			    TogglePlayerControllable(playerid, 1);
			}
		}
Код:
forward IsAFuelTruck(carid);//ftjob
Код:
public IsAFuelTruck(carid)//ftjob
{
	if(carid == 1801 || carid == 1825 || carid == 1806 || carid == 1792 || carid == 1794)
	{
		return 1;
	}
	return 0;
}
This code below = OnGameModeInt

Код:
	PlayerHaul[1801][pCapasity] = 100;
	PlayerHaul[1825][pCapasity] = 100;
	PlayerHaul[1806][pCapasity] = 50;
	PlayerHaul[1792][pCapasity] = 20;//ftjob
	PlayerHaul[1794][pCapasity] = 20;//ftjob
Код:
if(strcmp(cmd, "/buyfuel", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
            if(PlayerInfo[playerid][pJob] == 16)
			{
				new tmpcar = GetPlayerVehicleID(playerid);
				new compcost = 10;
				if(IsPlayerInRangeOfPoint(playerid,5.0, -1033.5093,-625.7611,32.0078))
				{
				    if(IsAFuelTruck(tmpcar) && IsTrailerAttachedToVehicle(tmpcar))
					{
					    if(PlayerHaul[tmpcar][pFuelLoad] < PlayerHaul[tmpcar][pCapasity])
						{
						    new amount;
						    tmp = strtok(cmdtext, idx);
							if(!strlen(tmp))
							{
								SendClientMessage(playerid, COLOR_GRAD1, "   USAGE: /buyfuel [amount]");
								return 1;
							}
							amount = strval(tmp);
							if(amount < 1 || amount > 10) { SendClientMessage(playerid, COLOR_GREY, "   Can't buy less than 1 Fuel Product or more then 10 !"); return 1; }
							new check= PlayerHaul[tmpcar][pFuelLoad] + amount;
							if(check > PlayerHaul[tmpcar][pCapasity])
							{
							    format(string, sizeof(string), "   You went over the Truck's Fuel Load Limit of %d, you currently have %d Fuel loaded.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pFuelLoad]);
	                            SendClientMessage(playerid, COLOR_GREY, string);
							    return 1;
							}
							new cost = amount*compcost;
							if(GetPlayerMoney(playerid) >= cost)
							{
							    if(PlayerInfo[playerid][pTankerTime] == 0)
							    {
									if(LoadTankerTime[playerid] <= 1)
									{
									    PlayerInfo[playerid][pTankerTime] = 1800;
									    LoadTankerTime[playerid] += 1;
									    TogglePlayerControllable(playerid, 0);
										PlayerHaul[tmpcar][pFuelLoad] += amount;
										format(string, sizeof(string), "   Fuel: %d,000/%d,000 Gallons.", PlayerHaul[tmpcar][pFuelLoad],PlayerHaul[tmpcar][pCapasity]);
										SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
										format(string, sizeof(string), "   You bought %d,000 Gallons of fuel for $%d.", amount,cost);
										SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
										SendClientMessage(playerid, COLOR_PURPLE, "   The Fuel Tanker is being filled, please wait");
										GivePlayerMoney(playerid,-cost);
										PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
										return 1;
									}
								}
								else
								{
								    SendClientMessage(playerid, COLOR_GREY, "   There is no Fuel available at the moment, please wait");
								    return 1;
								}
							}
							else
							{
								format(string, sizeof(string), "   You cant afford %d,000 Gallons of Fuel at $%d !", amount,cost);
								SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
								return 1;
							}
						}
						else
						{
								format(string, sizeof(string), "   Fuel: %d,000/%d,000 Gallons.", PlayerHaul[tmpcar][pFuelLoad],PlayerHaul[tmpcar][pCapasity]);
								SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
								return 1;
						}
					}
					else
					{
						SendClientMessage(playerid, TEAM_GROVE_COLOR, "   This Vehicle does not deliver Fuel Products or there is no trailer attach.");
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, TEAM_GROVE_COLOR, "   Your not at the Fuel Refinery.");
					return 1;
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD1, "   You are not a Truck Driver.");
			return 1;
		}
		return 1;
	}
	if(strcmp(cmd, "/sellfuel", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
		    new tmpcar = GetPlayerVehicleID(playerid);
			if(IsAFuelTruck(tmpcar) && IsTrailerAttachedToVehicle(tmpcar))
			{
				if (IsPlayerInRangeOfPoint(playerid, 5.0, 2486.4705,-2082.4055,13.1109))
				{
					if (PlayerHaul[tmpcar][pFuelLoad] >= 1)
					{
						new cashmade = PlayerHaul[tmpcar][pFuelLoad]*15;
					    UnloadTankerTime[playerid] += 1;
					    TogglePlayerControllable(playerid, 0);
						ConsumingMoney[playerid] = 1;
						GivePlayerMoney(playerid,cashmade);
						PlayerHaul[tmpcar][pFuelLoad] = 0;
						SendClientMessage(playerid, COLOR_YELLOW, "All fuel in the Truck has been Sold.");
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "   There is no fuel Loaded, return to the Fuel Refinery.");
						return 1;
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GRAD1, "   You are not at Los Santos Trucker Docks.");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   You are not in a Fuel Tanker or do not have a Trailer attached.");
			    return 1;
			}
		}
	}
Reply


Messages In This Thread
Trucker Job Issue - by EdeniaGaming - 11.07.2011, 02:58
Re: Trucker Job Issue - by dowster - 11.07.2011, 05:30
Re: Trucker Job Issue - by EdeniaGaming - 11.07.2011, 16:43
Re: Trucker Job Issue - by Adil - 11.07.2011, 16:50
Re: Trucker Job Issue - by EdeniaGaming - 11.07.2011, 16:55
Re: Trucker Job Issue - by Toreno - 11.07.2011, 16:59
Re: Trucker Job Issue - by EdeniaGaming - 11.07.2011, 17:04
Re: Trucker Job Issue - by EdeniaGaming - 11.07.2011, 20:05
Re: Trucker Job Issue - by beauhobbs - 11.07.2011, 20:39
Re: Trucker Job Issue - by dowster - 12.07.2011, 01:40

Forum Jump:


Users browsing this thread: 2 Guest(s)