Jump to content
  • 0

ajutor va rog


cr3azy

Question

am mare nevoie de ajutor.... am comanda asta de /buyprods

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))
			{
				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(PlayerInfo[playerid][pCash] >= cost)
						{
							PlayerHaul[tmpcar][pLoad] += amount;
							format(string, sizeof(string), "Products: %d/500.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "You bought %d Products for %s.", amount,cost);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-cost;
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							return 1;
						}
						else
						{
							format(string, sizeof(string), "You cant afford %d Products at %s !", amount,cost);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							return 1;
						}
					}
					else
					{
							format(string, sizeof(string), "Products: %d/500.", 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;
				}
			}
		}
		return 1;
	}
dar cand dau de ex.: /buyprods 500 imi apare products 0/0 am si
if(IsATruck(newcar))
		{
			format(string, sizeof(string), "Products: %d/500", PlayerHaul[403][pLoad],PlayerHaul[403][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");
		}

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

PlayerHaul[TRAILER][pCapasity] = 500;

PlayerHaul[TRAILER2][pCapasity] = 500;

PlayerHaul[TRAILER3][pCapasity] = 500;

PlayerHaul[TRUCK4][pCapasity] = 250;

LoadCar();

for(new h = carsonserver; h < sizeof(CarInfo); h++)

{

AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);

} si aici

Link to comment
Share on other sites

Daca masinile tale de trucker sunt definite cu TRAILER, TRAILER2, TRAILER3 si TRUCK4 atunci trebuie sa urmezi urmatorii pasi

prima data schimba ce ai tu cu asta

[pawn]

public IsATruck(carid)

{

if(carid == TRAILER || carid == TRAILER2 || carid == TRAILER3 || carid == TRUCK4)

{

return 1;

}

return 0;

}

[/pawn]

si la comanda modifici cu asta care ti-am pus eu mai jos

[pawn]

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))

{

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 > PlayerHaul[tmpcar][pCapasity]) { 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(PlayerInfo[playerid][pCash] >= 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 %s.", amount,cost);

SendClientMessage(playerid, TEAM_GROVE_COLOR, string);

PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-cost;

PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);

return 1;

}

else

{

format(string, sizeof(string), "You cant afford %d Products at %s !", 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;

}

}

}

return 1;

}

[/pawn]

PS: Nush cum ai reusit tu sa compilezi cu comenzile care le-ai dat, dar fie incearca asa. Daca nici asa nu merge da si liniile unde ai create masinile de trucker

sunt total in regula scripturile de mai sus :|

Nu te baga daca habar nu ai cu ce se mananca scripturile

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.