Trucker Job Problem.
#1

i use larp based gm , and my trucker job is bugged or something. When i go prods truck it shows prods 0/0 and i cant buy prods too , i checked the code hundred times , but i didnt find nothing wrong :S Mabye anyone can help me ?

Code :

Code:
enum pHaul
{
	pCapasity,
	pLoad,
	pFuelLoad,//ftjob
};

new PlayerHaul[][pHaul];
Code:
if(IsATruck(newcar))
		{
		  if(PlayerInfo[playerid][pJob] == 16)
			{
				format(string, sizeof(string), "Products: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
				SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
				SendClientMessage(playerid, COLOR_WHITE, "INFO: You can deliver Products to Businesses.");
				SendClientMessage(playerid, COLOR_WHITE, "INFO: Commands are /load /buyprods /sellprods");
			}
			else
			{
	    	RemovePlayerFromVehicle(playerid);
	    	SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
			}
		}
Code:
 PlayerHaul[108][pCapasity] = 100;
	PlayerHaul[109][pCapasity] = 100;
	PlayerHaul[110][pCapasity] = 50;
	PlayerHaul[111][pCapasity] = 50;
Code:
if(strcmp(cmd, "/load", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			if(tmpcar < 109 || tmpcar > 112)
			{
				GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
				return 1;
			}
			format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
			SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
		}
		return 1;
	}
	if(strcmp(cmd, "/buyprods", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			new compcost = 20;
			if(PlayerToPoint(70.0, playerid, 2468.4919,-2092.9902,13.5469))
			{
				if(IsATruck(tmpcar))
				{
					if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
					{
					  new amount;
					  tmp = strtok(cmdtext, idx);
						if(!strlen(tmp))
						{
							SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /buyprods [amount]");
							return 1;
						}
						amount = strval(tmp);
						if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, "  Can't buy less then 1 Product or more then 500!"); return 1; }
						new check= PlayerHaul[tmpcar][pLoad] + amount;
						if(check > PlayerHaul[tmpcar][pCapasity])
						{
						  format(string, sizeof(string), "  You went over the Truck Products Carry Limit of %d, you currently carry %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), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							SafeGivePlayerMoney(playerid,-cost);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							return 1;
						}
						else
						{
							format(string, sizeof(string), "You cant afford %d Products at $%d!", amount,cost);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							return 1;
						}
					}
					else
					{
							format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Products.");
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not in trucker place.");
				return 1;
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/sellprods", true) == 0)
	{
	  new cashmade;
	  new tmpcar;
	  if(IsPlayerConnected(playerid))
		{
			tmpcar = GetPlayerVehicleID(playerid);
			if(!IsATruck(tmpcar))
			{
				GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
				return 1;
			}
			if(PlayerHaul[tmpcar][pLoad] == 0)
			{
				GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
				format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
				SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
				return 1;
			}
			for(new i = 0; i < sizeof(BizzInfo); i++)
			{
				if (PlayerToPoint(10, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
				{
					//printf("Found House :%d",i);
					for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
					{
						if(BizzInfo[i][bProducts] == BizzInfo[i][bMaxProducts])
						{
							GameTextForPlayer(playerid, "~r~Our stores are full", 5000, 1);
							format(string, sizeof(string), "Cash Earned $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							return 1;
						}
						if(BizzInfo[i][bPriceProd] > BizzInfo[i][bTill])
						{
							GameTextForPlayer(playerid, "~r~We Cant Afford The Deal", 5000, 1);
							format(string, sizeof(string), "Cash Earned $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							return 1;
						}
						PlayerHaul[tmpcar][pLoad]--;
						BizzInfo[i][bProducts]++;
						cashmade = cashmade+BizzInfo[i][bPriceProd];
						//ConsumingMoney[playerid] = 1;
						SafeGivePlayerMoney(playerid,BizzInfo[i][bPriceProd]);
						BizzInfo[i][bTill] -= BizzInfo[i][bPriceProd];
						if(PlayerHaul[tmpcar][pLoad] == 0)
						{
							GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
							format(string, sizeof(string), "Cash Earned $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							return 1;
						}
					}
					OnPropUpdate();
					return 1;
				}
			}
		}
		for(new i = 0; i < sizeof(SBizzInfo); i++)
		{
			if (PlayerToPoint(10, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
			{
				//printf("Found House :%d",i);
				for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
				{
					if(SBizzInfo[i][sbProducts] == SBizzInfo[i][sbMaxProducts])
					{
						GameTextForPlayer(playerid, "~r~Our stores are full", 5000, 1);
						format(string, sizeof(string), "Cash Earned $%d.", cashmade);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						return 1;
					}
					if(SBizzInfo[i][sbPriceProd] > SBizzInfo[i][sbTill])
					{
						GameTextForPlayer(playerid, "~r~We Cant Afford The Deal", 5000, 1);
						format(string, sizeof(string), "Cash Earned $%d.", cashmade);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						return 1;
					}
					PlayerHaul[tmpcar][pLoad]--;
					SBizzInfo[i][sbProducts]++;
					cashmade = cashmade+SBizzInfo[i][sbPriceProd];
					//ConsumingMoney[playerid] = 1;
					SafeGivePlayerMoney(playerid,SBizzInfo[i][sbPriceProd]);
					SBizzInfo[i][sbTill] -= SBizzInfo[i][sbPriceProd];
					if(PlayerHaul[tmpcar][pLoad] == 0)
					{
						GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
						format(string, sizeof(string), "Cash Earned $%d.", cashmade);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						return 1;
					}
				}
				OnPropUpdate();
				return 1;
			}
		}
		GameTextForPlayer(playerid, "~r~To Far From A Business", 5000, 1);
		return 1;
	}

Reply
#2

Are you sure that your trucks vehicleid's are 108-111 ?
Reply
#3

Quote:
Originally Posted by MadeMan
Are you sure that your trucks vehicleid's are 108-111 ?
ye

//-------------------------------------------------------------------------------------------
AddStaticVehicleEx(456,864.1678,-1256.0752,14.5427,272.3933,14,14,30000); // Component Truck Yankee 108
AddStaticVehicleEx(456,864.1365,-1245.6500,14.5847,267.5993,14,14,30000); // Component Truck Yankee 109
AddStaticVehicleEx(482,849.8930,-1296.1844,13.3372,269.6171,14,14,30000); // Component truck burrito 110
AddStaticVehicleEx(482,849.9528,-1289.4707,13.4892,270.2147,14,14,30000); // Component truck burrito 111
//-------------------------------------------------------------------------------------------
Reply
#4

Use this code

pawn Code:
new carid[4];
    carid[0] = AddStaticVehicleEx(456,864.1678,-1256.0752,14.5427,272.3933,14,14,30000); // Component Truck Yankee 108
    carid[1] = AddStaticVehicleEx(456,864.1365,-1245.6500,14.5847,267.5993,14,14,30000); // Component Truck Yankee 109
    carid[2] = AddStaticVehicleEx(482,849.8930,-1296.1844,13.3372,269.6171,14,14,30000); // Component truck burrito 110
    carid[3] = AddStaticVehicleEx(482,849.9528,-1289.4707,13.4892,270.2147,14,14,30000); // Component truck burrito 111
    printf("Truck IDs: %i|%i|%i|%i", carid[0], carid[1], carid[2], carid[3]);
Run the server and then you will see.
Reply
#5

Quote:
Originally Posted by MadeMan
Use this code

pawn Code:
new carid[4];
    carid[0] = AddStaticVehicleEx(456,864.1678,-1256.0752,14.5427,272.3933,14,14,30000); // Component Truck Yankee 108
    carid[1] = AddStaticVehicleEx(456,864.1365,-1245.6500,14.5847,267.5993,14,14,30000); // Component Truck Yankee 109
    carid[2] = AddStaticVehicleEx(482,849.8930,-1296.1844,13.3372,269.6171,14,14,30000); // Component truck burrito 110
    carid[3] = AddStaticVehicleEx(482,849.9528,-1289.4707,13.4892,270.2147,14,14,30000); // Component truck burrito 111
    printf("Truck IDs: %i|%i|%i|%i", carid[0], carid[1], carid[2], carid[3]);
Run the server and then you will see.
Yes , Car Ids are OK
Reply
#6

Please help ! i`d like to get help fast.
Reply
#7

BUMP
Reply
#8

bump
Reply
#9

bump
Reply
#10

i have got the samp bug
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)