Pawn compiler library stopped working...What's wrong with this code?
#1

I've looked through the following code several times and am seriously unsure of what's wrong with it. The last time I compiled--back before I wrote any of this command--my script was running error-free (did have a few warnings due to some unused variables which I'll be implementing in time, but of course, insignificant to the point of being ignored), now it's apparently broken to the point of the compiler repeatedly stopping immediately after I press "Compile" in Pawno.

Can someone help with the analysis and find what I've done wrong here? I'm so confused. (Note: There are some indenting derps whose onus is on the forum, not myself).

Код:
CMD:help(playerid,params[])
{
	new command[128],suggestions[4][128],temp[128];
	new success = 0;
	new sugcount = 0;
	new tracksug = 1;
	new fm[128] = "Error: Could not find any matches for the specified command. (Entered \"%s\").";
	if(!sscanf(params,"s",command))
	{
	    new commandArray[2][3][128] = {{"/admin","/admin [optional: id] [optional:1/0] (Must enter at least one parameter)","Returns if a player is admin or can be used to give or take admin status."},{"/help","/help /[command]","Returns information about the entered command (must include slash before command)"}};
	    if(command[0] == "/")
	    {
	        new i;
	        for(i = 0; i < sizeof(commandArray); i++)
	        {
				if(command == commandArray[i][0])
				{
				    SuccessMessage(playerid,commandArray[i][1]);
				    SuccessMessage(playerid,commandArray[i][2]);
				    success = 1;
				} else if(tracksug == 1)
				{
                                        strmid(suggestions[sugcount],commandArray[i][0],0,sizeof(command),sizeof(suggestions[sugcount]);
					if(strcmp(command,suggestions[sugcount]))
					{
					    sugcount++;
					    if(sugcount == 4) tracksug = 0;
					} else {
					    suggestions[sugcount] = "";
					}
				} else if(tracksug == 0)
				{
					strmid(temp,commandArray[i][0],0,sizeof(command),sizeof(suggestions[sugcount]);
					if(strcmp(command,temp))
					{
					    sugcount++;
					}
				}
	        }
	        if(i == sizeof(commandArray) && success == 0)
	        {
	            if(sugcount == 0)
	            {
	            	format(fm,sizeof(fm),fm,command);
	            	ErrorMessage(playerid,fm);
	            } else if(sugcount  > 0)
	            {
	                if(tracksug == 1)
	                {
	                    fm = "Error: Found %i similar commands, but no exact match. (Entered \"%s\"):";
	                    new fm2[128];
	                    if(sugcount == 1)
	                    {
	                        fm2 = "%s";
				format(fm2,sizeof(fm2),fm2,suggestions[0]);
	                    } else if(sugcount == 2)
	                    {
	                        fm2 = "%s or %s";
	                        format(fm2,sizeof(fm2),fm2,suggestions[0],suggestions[1],"","");
	                    } else if(sugcount == 3)
	                    {
	                        fm2 = "%s, %s, or %s";
	                        format(fm2,sizeof(fm2),fm2,suggestions[0],suggestions[1],suggestions[2],"");
	                    } else if(sugcount == 4)
	                    {
	                        fm2 = "%s, %s, %s, or %s";
	                        format(fm2,sizeof(fm2),fm2,suggestions[0],suggestions[1],suggestions[2],suggestions[3]);
	                    }
	                	format(fm,sizeof(fm),fm,sugcount,command);
		} else if(tracksug == 0)
		{
			fm = "Error: Found over 4 similar commands (Entered \"%s\"):";
	                new fm2 = "%s, %s, %s, %s, and %i unshown others (use /commands to see all existing commands)";
	                    format(fm,sizeof(fm),fm,command);
                         format(fm2,sizeof(fm2),fm2,suggestions[0],suggestions[1],suggestions[2],suggestions[3],sugcount - 4);
					}
	            }
	        }
	    } else {
	        ErrorMessage(playerid,"USAGE: /help /[command]");
	    }
	} else if(sscanf(params,"s",command)){
	    ErrorMessage(playerid,"USAGE: /help /[command]");
	}
	return 1;
}
Reply


Messages In This Thread
Pawn compiler library stopped working...What's wrong with this code? - by Fierro - 07.09.2013, 23:22
Re: Pawn compiler library stopped working...What's wrong with this code? - by Jstylezzz - 08.09.2013, 10:33
Re: Pawn compiler library stopped working...What's wrong with this code? - by Fierro - 08.09.2013, 16:54

Forum Jump:


Users browsing this thread: 1 Guest(s)