error 047: array sizes do not match, or destination array is too small
#1

Well, as the title says. I always have that error.

Код:
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(4000) : warning 235: public function lacks forward declaration (symbol "Audio_OnSetPack")
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(12321) : warning 217: loose indentation
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(20500) : warning 213: tag mismatch
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(38547) : warning 217: loose indentation
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(42311) : warning 204: symbol is assigned a value that is never used: "string"
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(50361) : warning 217: loose indentation
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(53750) : error 047: array sizes do not match, or destination array is too small
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(68089) : error 047: array sizes do not match, or destination array is too small
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(73958) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
The Code:
Код:
			employer = "San Andreas National Guard";
			switch(PlayerInfo[playerid][pRank])
			{
				case 0: rank= "Private";
				case 1: rank = "Corporal";
				case 2: rank = "Sergeant";
				case 3: rank = "Lieutenant";
				case 4: rank = "Captain";
				case 5: rank = "Major";
				case 6: rank = "General";
				default: rank = "Private";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
				case 1: division = "(G.D.) ";
			    case 2: division = "(ARM) ";
			    case 3: division = "(AIR) ";
			    case 4: division = "(CMD) ";
			    case 5: division = "(F.T.O.) ";
			    default: division = "(G.D.) ";
			}
		}
The Second error code:
Код:
CMD:profile(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
	{
		new string[128], giveplayerid;
		if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /profile [playerid]");

		if(IsPlayerConnected(giveplayerid))
		{
			new ftext[24];
			if(PlayerInfo[giveplayerid][pMember] == 1 || PlayerInfo[giveplayerid][pLeader] == 1)
			{ ftext = "LSPD"; }
			else if(PlayerInfo[giveplayerid][pMember] == 2 || PlayerInfo[giveplayerid][pLeader] == 2)
			{ ftext = "FBI"; }
			else if(PlayerInfo[giveplayerid][pMember] == 4 || PlayerInfo[giveplayerid][pLeader] == 4)
			{ ftext = "FDSA"; }
			else if(PlayerInfo[giveplayerid][pMember] == 6 || PlayerInfo[giveplayerid][pLeader] == 6)
			{ ftext = "The Government"; }
			else if(PlayerInfo[giveplayerid][pMember] == 7 || PlayerInfo[giveplayerid][pLeader] == 7)
			{ ftext = "SASD"; }
			else if(PlayerInfo[giveplayerid][pMember] == 8 || PlayerInfo[giveplayerid][pLeader] == 8)
			{ ftext = "Hitman Agency"; }
			else if(PlayerInfo[giveplayerid][pMember] == 9 || PlayerInfo[giveplayerid][pLeader] == 9)
			{ ftext = "SA News"; }
			else if(PlayerInfo[giveplayerid][pMember] == 10 || PlayerInfo[giveplayerid][pLeader] == 10)
			{ ftext = "Taxi Faction"; }
			else if(PlayerInfo[giveplayerid][pMember] == 11 || PlayerInfo[giveplayerid][pLeader] == 11)
			{ ftext = "San Andreas National Guard"; }
PLEASE HELP ME! THANK YOU!
Reply
#2

"San Andreas National Guard" is 26 characters so ftext should have size of 27 (26 + NULL).

Check the size of the string for the first one, you haven't posted it.

About Audio_OnSetPack, update the audio plugin and include file.
Reply
#3

Код:
CMD:d(playerid, params[])
{
	new string[128];
	if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/d)epartments [department chat]");

	new employer[16], rank[64], division[16];
	switch (PlayerInfo[playerid][pMember]) // Employer, Rank and Division data is pulled from here.
	{
	case 1:
		{
			employer = "LSPD";
			switch(PlayerInfo[playerid][pRank])
			{
			    case 1: rank = "Officer";
			    case 2: rank = "Senior Officer";
			    case 3: rank = "Corporal";
			    case 4: rank = "Sergeant";
			    case 5: rank = "Staff Sergeant";
				case 6: rank = "Lieutenant";
				case 7: rank = "Captain";
				case 8: rank = "Deputy Chief";
				case 9: rank = "Chief";
			    default: rank = "Cadet";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
               case 1: division = "(P.O.) ";
		       case 2: division = "(F.T.O.) ";
		       case 3: division = "(I.A.) ";
		       case 4: division = "(S.W.A.T.) ";
		       case 5: division = "(CMD) ";
		       default: division = "(P.O.) ";
			}
		}
	case 2:
		{
			employer = "FBI";
			switch(PlayerInfo[playerid][pRank])
			{
			    case 1: rank = "Intern";
			    case 2: rank = "Agent";
			    case 3: rank = "Senior Agent";
			    case 4: rank = "Special Agent";
			    case 5: rank = "Supervisor";
			    case 6: rank = "Senior Supervisor";
			    case 7: rank = "Assistant Director";
			    case 8: rank = "Vice Director";
			    case 9: rank = "Director";
			    default: rank = "Probationary Intern";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
	    		case 1: division = "(G.D.)";
			    case 2: division = "(C.I.D.) ";
			    case 3: division = "(F.O.) ";
			    case 4: division = "(O.C.U.) ";
			    case 5: division = "(I.A.) ";
				case 6: division = "(CMD) ";
			    default: division = "(G.D.) ";
			}
		}
		case 3:
		{
			employer = "SFPD";
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: rank = "Officer";
			    case 2: rank = "Senior Officer";
			    case 3: rank = "Corporal";
			    case 4: rank = "Sergeant";
			    case 5: rank = "Staff Sergeant";
				case 6: rank = "Lieutenant";
				case 7: rank = "Captain";
				case 8: rank = "Deputy Chief";
				case 9: rank = "Chief";
			    default: rank = "Cadet";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
				case 1: division = "(P.O.) ";
			    case 2: division = "(E.P.) ";
			    case 3: division = "(I.A.) ";
			    case 4: division = "(S.W.A.T.) ";
			    case 5: division = "(CMD) ";
			    default: division = "(P.O.) ";
			}
		}
	case 4:
		{
			employer = "FDSA";
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: rank = "Firefighter";
				case 2: rank = "Senior Firefighter";
				case 3: rank = "Fire Sergeant";
				case 4: rank = "Lieutenant";
				case 5: rank = "Captain";
				case 6: rank = "Battalion Chief";
				case 7: rank = "Assistant Chief";
				case 8: rank = "Deputy Fire Chief";
				case 9: rank = "Fire Chief";
				default: rank = "Recruit";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
			    case 1: division = "(G.D.) ";
			    case 2: division = "(H.R.) ";
			    case 3: division = "(E.M.S.) ";
			    case 4: division = "(F.D.) ";
			    case 5: division = "(I.A.) ";
			    case 6: division = "(CMD) ";
			    default: division = "(G.D.) ";
			}
		}
	case 5:
		{
			employer = "Judicial Branch";
			switch(PlayerInfo[playerid][pRank])
			{
	    		case 1: rank = "Clerk of Court";
	    		case 2: rank = "District Attorney";
	    		case 3: rank = "District Judge";
	    		case 4: rank = "Appellate Judge";
	    		case 5: rank = "Associate Justice of the Supreme Court";
			    case 6: rank = "Chief Justice of the Supreme Court";
		    	default: rank = "Clerk of Court";
			}
		}
	case 6:
		{
			employer = "State";
			switch(PlayerInfo[playerid][pRank])
			{
				case 1: rank = "Staff Member";
				case 2: rank = "G.E.T. Officer";
				case 3: rank = "Legislator";
				case 4: rank = "Government Cabinet";
				case 5: rank = "Vice President";
				case 6: rank = "President";
				default: rank = "Intern";
			}
		}
	case 7:
		{
			employer = "SASD";
			switch(PlayerInfo[playerid][pRank])
			{
                case 1: rank = "Deputy";
				case 2: rank = "Senior Deputy";
				case 3: rank = "Sergeant";
				case 4: rank = "Lieutenant";
				case 5: rank = "Captain";
				case 6: rank = "Sheriff";
				default: rank = "Trainee";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
                case 1: division = "(G.D.) ";
                case 2: division = "(F.T.O.) ";
    		    case 3: division = "(I.A.) ";
         	    case 4: division = "(CMD) ";
		        case 5: division = "(S.W.A.T.) ";
	    	    default: division = "(G.D.) ";
			}
		}
		case 11:
		{
			employer = "San Andreas National Guard";
			switch(PlayerInfo[playerid][pRank])
			{
				case 0: rank= "Private";
				case 1: rank = "Corporal";
				case 2: rank = "Sergeant";
				case 3: rank = "Lieutenant";
				case 4: rank = "Captain";
				case 5: rank = "Major";
				case 6: rank = "General";
				default: rank = "Private";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
				case 1: division = "(G.D.) ";
			    case 2: division = "(ARM) ";
			    case 3: division = "(AIR) ";
			    case 4: division = "(CMD) ";
			    case 5: division = "(F.T.O.) ";
			    default: division = "(G.D.) ";
			}
		}
		case 13:
		{
            employer = "Task Force";
			switch(PlayerInfo[playerid][pRank])
			{
			    case 0: rank = "Ensign";
				case 1: rank = "Marksman";
				case 2: rank = "Elite Marksman";
				case 3: rank = "Operative";
				case 4: rank = "Elite Operative";
				case 5: rank = "Vice Commander";
				case 6: rank = "Supreme Commander";
				default: rank = "Ensign";
			}
			switch(PlayerInfo[playerid][pDivision])
			{
				case 1: division = "(G.D.) ";
				case 2: division = "(AIR) ";
				case 3: division = "(ARM) ";
				case 4: division = "(I.A.) ";
				case 5: division = "(CMD) ";
			    default: division = "(G.D.) ";
			}
		}
This is the one
Reply
#4

What's the line of code which gives the error?
Reply
#5

Код:
			employer = "San Andreas National Guard";
Reply
#6

Change the size of employer which is 16 to 27.
Reply
#7

Thank you! If I can +rep on you I will do for sure. Anyways, what about the Warnings?

Код:
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(4000) : warning 235: public function lacks forward declaration (symbol "Audio_OnSetPack")
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(12321) : warning 217: loose indentation
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(20500) : warning 213: tag mismatch
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(38547) : warning 217: loose indentation
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(42311) : warning 204: symbol is assigned a value that is never used: "string"
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(50361) : warning 217: loose indentation
C:\Users\JohnMark\Desktop\FGRP NO MYSQL\gamemodes\SSRP.pwn(73958) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Warnings.
Reply
#8

public function lacks forward declaration (symbol "Audio_OnSetPack") -> http://forum.sa-mp.com/showpost.php?...55&postcount=2 (the last one)

loose indentation -> https://sampwiki.blast.hk/wiki/Errors_Li...se_indentation

tag mismatch -> post the line 20500

symbol is assigned a value that is never used: "string" -> You declare an array with name "string" and you don't use it anywhere. Use it or remove it; although it doesn't cause any problems.
Reply
#9

Код:
	CreateDynamicObject(1985, 2262.800050, -1725.500000, 1379,20, 0.000000, 0.000000, 0.000000); //object (punchbagnu) (1)
Reply
#10

Here:
pawn Код:
CreateDynamicObject(1985, 2262.800050, -1725.500000, 1379.20, 0.000000, 0.000000, 0.000000); //object (punchbagnu) (1)
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)