[POMOC] Dostavljac Produkta


Započeo marche123, Avgust 22, 2012, 19:53:38 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Edit Adrenalin
Detaljan opis problema:komanda na Dostavljac Produkta neradi /buyprods ev kod
Dio skripte:
SendClientMessage(playerid, COLOR_GRAD1, "Koriscenje: /buyprods [amount]");
							return 1;
						}
						amount = strval(tmp);
						if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, "   Ne mozete kupiti manje od 1 ni vise od 500 produkata!"); return 1; }
						new check= PlayerHaul[tmpcar][pLoad] + amount;
						if(check > PlayerHaul[tmpcar][pCapasity])
						{
						    format(string, sizeof(string), "   Presli ste preko limita za kamion od %d, sada vozite %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), "Produkti: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Kupili ste %d Produkte za $%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), "Ne mozete da priustite %d Produkata za $%d!", amount,cost);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							return 1;
						}
					}
					else
					{
							format(string, sizeof(string), "Produkti: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, TEAM_GROVE_COLOR, "Ne mozete vrsiti dostavu produkata sa ovim vozilom.");
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not in trucker place.");
				return 1;
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/prodajprodukte", true) == 0)
	{
	    new cashmade;
	    new tmpcar;
	    if(IsPlayerConnected(playerid))
		{
			tmpcar = GetPlayerVehicleID(playerid);
			if(!IsATruck(tmpcar))
			{
				GameTextForPlayer(playerid, "~r~Niste u kamionu za dostavu", 5000, 1);
				return 1;
			}
			if(PlayerHaul[tmpcar][pLoad] == 0)
			{
				GameTextForPlayer(playerid, "~r~Kamion je prazan, kupite produkte", 5000, 1);
				format(string, sizeof(string), "Produkti: %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~Nas biznis je fu;", 5000, 1);
							format(string, sizeof(string), "Zaradili ste $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Produkti: %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~Ne mozemo platiti za produkte", 5000, 1);
							format(string, sizeof(string), "Zaradili ste $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Produkti: %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];
						GivePlayerCash(playerid,BizzInfo[i][bPriceProd]);
						BizzInfo[i][bTill] -= BizzInfo[i][bPriceProd];
						if(PlayerHaul[tmpcar][pLoad] == 0)
						{
							GameTextForPlayer(playerid, "~r~Kamion je prazan, kupite produkte", 5000, 1);
							format(string, sizeof(string), "Zaradili ste $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Produkti: %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~Nas biznis je ful", 5000, 1);
						format(string, sizeof(string), "Zaradili ste $%d.", cashmade);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						format(string, sizeof(string), "Produkti: %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~Ne mozemo platiti za produkte", 5000, 1);
						format(string, sizeof(string), "Zaradili ste $%d.", cashmade);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						format(string, sizeof(string), "Produkti: %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];
					GivePlayerCash(playerid,SBizzInfo[i][sbPriceProd]);
					SBizzInfo[i][sbTill] -= SBizzInfo[i][sbPriceProd];
					if(PlayerHaul[tmpcar][pLoad] == 0)
					{
						GameTextForPlayer(playerid, "~r~Kamion je prazan, kupite produkte", 5000, 1);
						format(string, sizeof(string), "Zaradili ste $%d.", cashmade);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						format(string, sizeof(string), "Produkti: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
						SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
						return 1;
					}
				}
				OnPropUpdate();
				return 1;
			}
		}
		GameTextForPlayer(playerid, "~r~Predaleko ste od biznisa", 5000, 1);
		return 1;
	}