Trailer Problem
#2

Код:
	PlayerHaul[108][pCapasity] = 100;
	PlayerHaul[109][pCapasity] = 100;
	PlayerHaul[110][pCapasity] = 50;
	PlayerHaul[111][pCapasity] = 50;
So It Is Loading Vehicle Ids

Код:
	PlayerHaul[435][pCapasity] = 100;
	PlayerHaul[591][pCapasity] = 50;
I Need It To Load Model Ids

Then I Need It To Check If The Trailer Is Attached To The Truck Model Id 515

At The Moment It Doesn't Even Have Working Trailers
If you Get In The Truck It Vehicle Id 108 It Says You Have Products 0/100
And That's Without Trailer On


But The Script Has Been Edited So Now It Checks For The Trailer If There's No Trailer
It Wont Let You Buy Any Products
Код:
	if(strcmp(cmd, "/buyprods", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			new compcost = 20;
			if(IsPlayerInRangeOfPoint(playerid, 5, -45.69187,-224.1864,6.515688))
			{
				if(IsATruck(tmpcar) && IsTrailerAttachedToVehicle(tmpcar)) //Modded
				{
					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);
							GivePlayerCash(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 have a trailer to deliver Products.");
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not in trucker place.");
				return 1;
			}
		}
		return 1;
	}
This Is When You Are Trying To Buy Products

And The Truck Part There It Checks The Vehicle

Код:
		if(IsATruck(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pMember] == 17)
			{
				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 /loadfood");
			}
			else
			{
	        	RemovePlayerFromVehicle(playerid);
	        	SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
			}
		}
So What I Am Trying To Do Is Make The Trailer Say This

Код:
		if(IsATruck(newcar))
		{
		    if(PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pMember] == 17)
			{
				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 /loadfood");
			}
			else
			{
	        	RemovePlayerFromVehicle(playerid);
	        	SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
			}
		}
If The Truck Is Connected To The Right Trailer I Am Sorry If I am Making This Confusing

Can Some One Please Help
Reply


Messages In This Thread
Trailer Problem - by Angel- - 20.05.2011, 19:23
Re: Trailer Problem - by Angel- - 21.05.2011, 04:13

Forum Jump:


Users browsing this thread: 1 Guest(s)