Need help on trucker
#1

I need help on my buy gas It dont work at all

Code:
 if(strcmp(cmd, "/buyfuel", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
            if ((PlayerInfo[playerid][pJob] == 16))
			{
				new tmpcar = GetPlayerVehicleID(playerid);
				new compcost = 10;
				if(PlayerToPoint(5.0, playerid, 261.1522,1451.3818,10.1481))
				{
				    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;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)