SA-MP Forums Archive
[HELP] I need quick help please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] I need quick help please (/showthread.php?tid=360253)



[HELP] I need quick help please - devil shill - 17.07.2012

can someone tell me what is wrong with this script ? becouse it says everytime unknown command.

Код:
	if(strcmp(cmd, "/sellprods", true) == 0)
	{
	    new cashmade;
		new tmpcar;
		if(IsPlayerConnected(playerid))
		{
			tmpcar = GetPlayerVehicleID(playerid);
			if(!IsATruck(tmpcar))
			{
				GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
				return 1;
			}
			if(PlayerInfo[playerid][pTruckLoad] == 0)
			{
				GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
                format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
				SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
				return 1;
			}
			for(new i = 0; i < sizeof(BizzInfo); i++)
			{
				if (IsPlayerInRangeOfPoint(playerid, 10,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~Our stores are full", 5000, 1);
							format(string, sizeof(string), "Cash Earned $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
							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~We Cant Afford The Deal", 5000, 1);
							format(string, sizeof(string), "Cash Earned $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							return 1;
						}
						PlayerInfo[playerid][pTruckLoad]--;
						BizzInfo[i][bProducts]++;
						cashmade = cashmade+BizzInfo[i][bPriceProd];
						//ConsumingMoney[playerid] = 1;
						SafeGivePlayerMoney(playerid,BizzInfo[i][bPriceProd]);
						BizzInfo[i][bTill] -= BizzInfo[i][bPriceProd];
						if(PlayerInfo[playerid][pTruckLoad] == 0)
						{
							GameTextForPlayer(playerid, "~r~Truck is empty, return to the stock house", 5000, 1);
							format(string, sizeof(string), "Cash Earned $%d.", cashmade);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Products: %d.", PlayerInfo[playerid][pTruckLoad]);
							SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							return 1;
						}
					}
					OnPropUpdate(3,i);
					return 1;
				}
			}
		}



Re: [HELP] I need quick help please - cosmon - 17.07.2012

Command should return 1 or it will always show u Unknown Command

Код:
if(strcmp(cmd, "/sellprods", true) == 0)
{
	//Your stuff here
       return 1;
}



Re: [HELP] I need quick help please - devil shill - 17.07.2012

it returns on 1 multiple times...


Re: [HELP] I need quick help please - devil shill - 17.07.2012

could pleas someone help me


Re: [HELP] I need quick help please - cosmon - 17.07.2012

If is not returning at the end is useless , just remove all returns and add return 1 at final you will see that it will work