Jump to content
  • 0

va rog ajutor:(


cr3azy

Question

am problema cu vechea poveste... dau /buyprods dar imi apare intr.una products 0/0 ...

new PlayerHaul[500][pHaul];

if(IsATruck(newcar))
		{
			format(string, sizeof(string), "Products: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
			SendClientMessage(playerid, TEAM_GroveStreet_COLOR, string);
			SendClientMessage(playerid, COLOR_WHITE, "INFO: You can deliver Products to Businesses.");
			SendClientMessage(playerid, COLOR_WHITE, "INFO: Commands are /load /buyprods /sellprods");
		}
public IsATruck(carid)
{
	if(carid== TRUCK || carid== TRUCK2|| carid== TRUCK3 ||carid== TRUCK4)
	{
		return 1;
	}
	return 0;
}
stock IsATrailer(carid)
{
	if(carid== TRAILER || carid== TRAILER2 || carid== TRAILER3)
	{
		return 1;
	}
	return 0;
}
if(newcar == TRUCK || newcar == TRUCK2 || newcar == TRUCK3 || newcar == TRUCK4)
		{
            if(PlayerInfo[playerid][pJob] == 14){ }
		    else
			{
		        SendClientMessage(playerid,COLOR_GREY,"   You are not a Truker !");
		        RemovePlayerFromVehicle(playerid);
		    }
		}
   	TRUCK = AddStaticVehicle(403,-59.3948,-1131.5742,1.6842,68.4991,0,0); // TRUCK
	TRUCK2 = AddStaticVehicle(403,-61.0916,-1135.8716,1.6846,68.0794,0,0); // TRUCK1
	TRUCK3 = AddStaticVehicle(403,-62.8802,-1140.0293,1.6849,67.3893,0,0); // TRUCK2
	TRAILER = AddStaticVehicle(591,-78.3183,-1113.2704,0.8085,162.5001,0,0); // TRAILER
	TRAILER2 = AddStaticVehicle(591,-72.8625,-1114.8864,0.8052,165.5299,0,0); // TRAILER1
	TRAILER3 = AddStaticVehicle(591,-66.8893,-1116.2998,0.8052,163.0502,0,0); // TRAILER2
	TRUCK4 = AddStaticVehicleEx(440,2782.9,-2455.6,13.4,90.8,-1,-1,60000);//81Component Truck/*Rumpo*/
	PlayerHaul[TRAILER][pCapasity] = 500;
	PlayerHaul[TRAILER2][pCapasity] = 500;
	PlayerHaul[TRAILER3][pCapasity] = 500;
	PlayerHaul[TRUCK4][pCapasity] = 250;
if(strcmp(cmd, "/buyprods", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			new compcost = 50;
			if(PlayerToPoint(60.0, playerid, -78.9067,-1130.7458,0.6489))//2787.8,-2436.3,13.7
			{
				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_GroveStreet_COLOR, string);
							format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
							SendClientMessage(playerid, TEAM_GroveStreet_COLOR, string);
							GivePlayerMoney(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_GroveStreet_COLOR, string);
							return 1;
						}
					}
					else
					{
							format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GroveStreet_COLOR, string);
							return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, TEAM_GroveStreet_COLOR, "This Vehicle does not deliver Products.");
					return 1;
				}
			}
		}
		return 1;
	}

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

in loc de

[pawn]

              PlayerHaul[TRAILER][pCapasity] = 500;

PlayerHaul[TRAILER2][pCapasity] = 500;

PlayerHaul[TRAILER3][pCapasity] = 500;

PlayerHaul[TRUCK4][pCapasity] = 250;

[/pawn]

pune

[pawn]

              PlayerHaul[TRUCK][pCapasity] = 500;

PlayerHaul[TRUCK2][pCapasity] = 500;

PlayerHaul[TRUCK3][pCapasity] = 500;

PlayerHaul[TRUCK4][pCapasity] = 250;

[/pawn]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.