Jump to content
  • 0

[GF/RP] Problema Masinii


ToX1c

Question

Salut am schimbat la masini am facut ceva de genu ...

//-----------Masinii Trucker-------------
new truckcar1;
new truckcar2;
new truckcar3;
new truckcar4;
public IsATruck(carid)
{
	if(carid >= truckcar1 && carid <= truckcar3)
	{
		return 1;
	}
	return 0;
}
	PlayerHaul[truckcar2][pCapasity] = 100;
	PlayerHaul[truckcar1][pCapasity] = 100;
	PlayerHaul[truckcar4][pCapasity] = 50;
	PlayerHaul[truckcar3][pCapasity] = 50;
truckcar2 =	AddStaticVehicleEx(456,2795.2,-2417.8,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
truckcar1 =	AddStaticVehicleEx(456,2783.9,-2417.9,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
truckcar4 =	AddStaticVehicleEx(440,2794.1,-2455.9,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
truckcar3 =	AddStaticVehicleEx(440,2782.9,-2455.6,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
	if(strcmp(cmd, "/load", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			if(tmpcar < truckcar2 || tmpcar > truckcar4)
			{
				GameTextForPlayer(playerid, "~r~Nu esti intr-un camion de livrare", 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;
	}

Si cand ma urc in masina de trucker imi apare products 0/0

Link to comment
Share on other sites

22 answers to this question

Recommended Posts

Tot Nu merge..am incercat si /buyprods 100/50

Am facut asa ca nu mergea 2 masinii cand ma urcam in ele nu zicea nimic puteam sa merg cu ele..

public IsATruck(carid)
{
    if((carid >= truckcar1) && (carid <= truckcar4)|| carid == truckcar2 || carid == truckcar3)
	{
		return 1;
	}
	return 0;
}

si tot nu merge prods

Link to comment
Share on other sites

Ia incearca asa:

public IsATruck(carid)
{
    if(carid == truckcar1 || carid == truckcar2 || carid == truckcar3 || carid == truckcar4)
    {
        return 1;
    }
    return 0;
}
Si la /load:
if(tmpcar == truckcar1 || tmpcar == truckcar2 || tmpcar == truckcar3 || tmpcar == truckcar4)

Link to comment
Share on other sites

Nu intelegi eu vreau sa fac asa ca vreau sa bag un sistem de masini personale si sa nu se schimbe id-urile intre ele..

if(strcmp(cmd, "/buyprods", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			new compcost = 50;
			if(PlayerToPoint(60.0, playerid, 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_WHITE, "UTILIZARE: /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);
							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_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;
	}

Link to comment
Share on other sites

Ca sa nu iti arate 0/0, trebuie sa adaugi pCapasity dupa ce creezi masinile, adica asa:

truckcar2 =	AddStaticVehicleEx(456,2795.2,-2417.8,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
truckcar1 =	AddStaticVehicleEx(456,2783.9,-2417.9,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
truckcar4 =	AddStaticVehicleEx(440,2794.1,-2455.9,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
truckcar3 =	AddStaticVehicleEx(440,2782.9,-2455.6,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
PlayerHaul[truckcar2][pCapasity] = 100;
PlayerHaul[truckcar1][pCapasity] = 100;
PlayerHaul[truckcar4][pCapasity] = 50;
PlayerHaul[truckcar3][pCapasity] = 50;

Link to comment
Share on other sites

Incearca asa:

new PlayerHaul[MAX_VEHICLES][pHaul];
truckcar2 =	AddStaticVehicleEx(456,2795.2,-2417.8,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
truckcar1 =	AddStaticVehicleEx(456,2783.9,-2417.9,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
truckcar4 =	AddStaticVehicleEx(440,2794.1,-2455.9,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
truckcar3 =	AddStaticVehicleEx(440,2782.9,-2455.6,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
PlayerHaul[truckcar2][pCapasity] = 100;
PlayerHaul[truckcar1][pCapasity] = 100;
PlayerHaul[truckcar4][pCapasity] = 50;
PlayerHaul[truckcar3][pCapasity] = 50;
public IsATruck(carid)
{
	if(carid == truckcar1 || carid == truckcar2 || carid == truckcar3 || carid == truckcar4)
	{
		return 1;
	}
	return 0;
}
        if(strcmp(cmd, "/load", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new tmpcar = GetPlayerVehicleID(playerid);
			if(!IsATruck(tmpcar))
			{
				GameTextForPlayer(playerid, "~r~Nu esti intr-un camion de livrare", 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;
	}

Eu am asa si merge.

Link to comment
Share on other sites

C:\Documents and Settings\gamemodes\gxb.pwn(499) : error 017: undefined symbol "pHaul"

C:\Documents and Settings\gxb.pwn(499) : error 009: invalid array size (negative, zero or out of bounds)

C:\Documents and Settings\gxb.pwn(1387) : error 021: symbol already defined: "PlayerHaul"

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

3 Errors.

Linii

new PlayerHaul[MAX_VEHICLES][pHaul];
new PlayerHaul[100][pHaul];

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.