Help with Error 047
#1

Hello.
Thank you for taking the time to help me, or not.

Anyways I am getting this on Compile

Код:
C:\Documents and Settings\HP_Administrator\Desktop\samp02Xserver.win32\gamemodes\crp.pwn(7230) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\HP_Administrator\Desktop\samp02Xserver.win32\gamemodes\crp.pwn(7289) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\HP_Administrator\Desktop\samp02Xserver.win32\gamemodes\crp.pwn(9937) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\HP_Administrator\Desktop\samp02Xserver.win32\gamemodes\crp.pwn(10065) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\HP_Administrator\Desktop\samp02Xserver.win32\gamemodes\crp.pwn(10378) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Okay naturally, my response was to comment these lines.

Then I got a whole new set of problems, the commands didn't work In game, but the script compiles.

Any way I fix this?

===========================
Lines/Surrounding code.
Код:
	if(strcmp(cmd,"/buydrink",true)==0)
	{
	 	if(IsPlayerConnected(playerid))
	 	{
  			for(new i = 0; i < sizeof(Businesses); i++)
			{
				if (PlayerToPoint(25.0, playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ]))
				{
					if(GetPlayerVirtualWorld(playerid) == i)
					{
			  		if(Businesses[i][BizType] == 7)
			  		{
			  			new x_info[128];
							x_info = strtok(cmdtext, idx);

							if(!strlen(x_info)) {
								SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /buydrink [item]");
								SendClientMessage(playerid, COLOR_WHITE, "[ITEM:] Beer - Price: $7.");
								SendClientMessage(playerid, COLOR_WHITE, "[ITEM:] Vodka - Price: $10.");
								SendClientMessage(playerid, COLOR_WHITE, "[ITEM:] Cola - Price: $3.");
								SendClientMessage(playerid, COLOR_WHITE, "[ITEM:] Water - Price: $3.");
								SendClientMessage(playerid, COLOR_WHITE, "[ITEM:] Whiskey - Price: $10.");
								SendClientMessage(playerid, COLOR_WHITE, "[ITEM:] Brandy - Price: $15.");
								SendClientMessage(playerid, COLOR_WHITE, "[ITEM:] Soda - Price: $3.");
								return 1;
							}
				    	if(Businesses[i][Products] != 0)
				    	{
				    	  new Float:HP;
				    	  GetPlayerHealth(playerid,HP);
								if(strcmp(x_info,"beer",true) == 0)
								{
									if(GetPlayerCash(playerid) >= 7)
									{
	      						GivePlayerCash(playerid,-7);
           		    	Businesses[i][Till] += 7;
            		  Businesses[i][Products]--;
               		if(HP < 100)
            		  {
             		 		SetPlayerHealth(playerid,HP+15.0);
             		 	}
							 		PlayerActionMessage(playerid,15.0,"has just bought a beer, then drinks it.");
							 		SaveBusinesses();
							 		return 1;
									}
									else
									{
									  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have enough money.");
									  return 1;
									}
								}
Код:
 	if(strcmp(cmd,"/buyweapon",true)==0)
	{
 	if(IsPlayerConnected(playerid))
 	{
 		for(new i = 0; i < sizeof(Businesses); i++)
		{
			if (PlayerToPoint(25.0, playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ]))
			{
				if(GetPlayerVirtualWorld(playerid) == i)
	  			{
				  if(Businesses[i][BizType] == 4) //Ammunation
			  	{
		    		if(Businesses[i][Products] != 0)
		    		{
							new x_info[128];
							x_info = strtok(cmdtext, idx);
						  new wstring[128];

							if(!strlen(x_info)) {
								format(wstring, sizeof(wstring), "[------------------------[%s]------------------------]", Businesses[i][BusinessName]);
								SendClientMessage(playerid, COLOR_LIGHTGREEN, wstring);
								SendClientMessage(playerid, COLOR_RED, "(Type name, no spaces, no capitals. Example. deagle)");
								SendClientMessage(playerid, COLOR_WHITE, "* Deagle - Price: $3500 - 200 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* MP5 - Price: $5000 - 500 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* M4 - Price: $5000 - 500 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* Country Rifle - Price: $8000 - 500 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* Sniper Rifle - Price: $12000 - 500 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* Silenced Pistol - Price: $3500 - 200 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* Shotgun - Price: $4500 - 200 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* Pepperspray - Price:$1000 - 500 Ammo.");
								SendClientMessage(playerid, COLOR_WHITE, "* Body Armour - Price: $1500.");
								SendClientMessage(playerid, COLOR_LIGHTGREEN, "[-------------------------------------------------------------------------------------] ");
								return 1;
							}
							if(PlayerInfo[playerid][pWepLic])
							{
								if(strcmp(x_info,"deagle",true) == 0)
								{
									if(GetPlayerCash(playerid) >= 3500)
									{
									  GivePlayerWeapon(playerid,24,200);
									  GivePlayerCash(playerid,-3500);
									  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[SUCCESS:] You have successfully bought a Desert Eagle.");
									  Businesses[i][Products]--;
									  Businesses[i][Till]+=3500;
									  SaveBusinesses();
									  PlayerActionMessage(playerid,15.0,"gives the store clerk some money and gets a weapon back in return.");
									  return 1;

									}
									else
									{
									  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have enough money!");
									  return 1;
									}
								}
Код:
	if(strcmp(cmd,"/accept",true)==0)
	{
 	if(IsPlayerConnected(playerid))
 	{
		new x_info[128];
		x_info = strtok(cmdtext, idx);
	  new wstring[128];
	  
		if(!strlen(x_info)) {
			SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /accept [usage]");
			SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGES:] faction - ticket - products");
			return 1;
		}
		if(strcmp(x_info,"faction",true) == 0)
		{
		  new faction = FactionRequest[playerid];
			if (FactionRequest[playerid] != 255)
			{
				if(PlayerInfo[playerid][pFaction] == 255)
				{
	  				format(wstring, sizeof(wstring), "[INFO:] Congratulations! Your now a member of: %s.",DynamicFactions[faction][fName]);
				  SendClientMessage(playerid,COLOR_LIGHTBLUE, wstring);
					PlayerInfo[playerid][pFaction] = FactionRequest[playerid];
					PlayerInfo[playerid][pRank] = DynamicFactions[faction][fJoinRank];
					SetPlayerSpawn(playerid);
					FactionRequest[playerid] = 255;
					format(wstring, sizeof(wstring), "[FACTION:] %s has just joined the faction.",GetPlayerNameEx(playerid));
					SendFactionMessage(PlayerInfo[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
				}
				else
				{
					SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] Your already in a faction, leave that first!");
				}
			}
			else
			{
			  SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] You have not been offered to join a faction!");
			}
		}
 		else if(strcmp(x_info,"ticket",true) == 0)
				{
			  if(TicketOffer[playerid] < 999)
			  {
			    if(IsPlayerConnected(TicketOffer[playerid]))
			    {
			      if (ProxDetectorS(5.0, playerid, TicketOffer[playerid]))
						{
							if(GetPlayerCash(playerid) >= TicketMoney[playerid])
						  {
								format(string, sizeof(string), "[INFO:] Ticket Paid - Cost: $%d.", TicketMoney[playerid]);
								SendClientMessage(playerid, COLOR_WHITE, string);
								format(string, sizeof(string), "[INFO:] %s has paid your ticket - Cost: $%d.", GetPlayerNameEx(playerid), TicketMoney[playerid]);
								SendClientMessage(TicketOffer[playerid], COLOR_LIGHTYELLOW2, string);
								new faction = PlayerInfo[TicketOffer[playerid]][pFaction];
								DynamicFactions[faction][fBank] += TicketMoney[playerid];
								GivePlayerCash(playerid, - TicketMoney[playerid]);
								TicketOffer[playerid] = 999;
								TicketMoney[playerid] = 0;
								return 1;
							}
							else
							{
							  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have enough money!");
							  return 1;
							}
						}
						else
						{
						  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You must be near the officer that gave you the ticket!");
						  return 1;
						}
			    }
				}
				else
				{
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have a ticket!");
				  return 1;
				}
			}
   		else if(strcmp(x_info,"products",true) == 0)
				{
			  if(ProductsOffer[playerid] < 999)
			  {
			    if(IsPlayerConnected(ProductsOffer[playerid]))
			    {
			      if (ProxDetectorS(5.0, playerid, ProductsOffer[playerid]))
						{
						  if(GetPlayerCash(playerid) >= ProductsCost[playerid])
						  {
								if(PlayerInfo[playerid][pBizKey] != 255)
								{
									format(string, sizeof(string), "[INFO:] Products Purchased - Cost: $%d.", ProductsCost[playerid]);
									SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
									format(string, sizeof(string), "[INFO:] %s has bought products from you - Cost: $%d.", GetPlayerNameEx(playerid), ProductsCost[playerid]);
									SendClientMessage(ProductsOffer[playerid], COLOR_LIGHTYELLOW2, string);
									new bizkey = PlayerInfo[playerid][pBizKey];
									Businesses[bizkey][Products] += ProductsAmount[playerid];
									GivePlayerCash(playerid, -ProductsCost[playerid]);
									GivePlayerCash(ProductsOffer[playerid], ProductsCost[playerid]);
									PlayerInfo[ProductsOffer[playerid]][pProducts] -= ProductsAmount[playerid];
									ProductsOffer[playerid] = 999;
									ProductsCost[playerid] = 0;
									ProductsAmount[playerid] = 0;
									SaveBusinesses();
									return 1;
								}
							}
							else
							{
							  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have enough money!");
							  return 1;
							}
						}
						else
						{
						  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You arn't near the person that offered you products!");
						  return 1;
						}
			    }
				}
				else
				{
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You havn't been offered products!");
				  return 1;
				}
			}
	}
	return 1;
}
Reply
#2

Which lines?
Reply
#3

You will correct the error changing this: new x_info[128]; to new x_info[256];

but I dont know whats the point of that, can anyone tell me what will happen if I change it to 256?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)