SA-MP Forums Archive
Invalid Function or Declaration! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Invalid Function or Declaration! (/showthread.php?tid=97337)



Invalid Function or Declaration! - Don_Corello - 13.09.2009

Well' im currently making a 0.3 Registration system using the Dialog boxes, but when i try to compile my script i get this Error:

Код:
C:\Users\Mike\Desktop\0.3 beta\filterscripts\registersystem.pwn(304) : warning 217: loose indentation
C:\Users\Mike\Desktop\0.3 beta\filterscripts\registersystem.pwn(306) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Some of my Script:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  new playername[MAX_PLAYER_NAME];
	if(dialogid == 0) { // Our example msgbox
		if(response) {
		  	  new loginmsg[256+1];
		  	  new tmp[256];
	  			new loginname[MAX_PLAYER_NAME+1];
	  			GetPlayerName(playerid,loginname,MAX_PLAYER_NAME);
	  			format(loginmsg,256,"Welcome to NY-Roleplay.\n %s\n\nPlease login!",loginname);
					ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"NY-Gaming Login!",loginmsg,"Login","Cancel");
	    		new tmppass[64];
	    		new idx;
					if(gPlayerLogged[playerid] == 1)
					{
						SendClientMessage(playerid, COLOR_GREY, "	You are already logged in.");
						return 1;
					}
					tmp = strtok(inputtext, idx);
					if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GREY, "	USAGE: /login [password]");
						return 1;
					}
					strmid(tmppass, tmp, 0, strlen(inputtext), 255);
					Encrypt(tmppass);
					OnPlayerLogin(playerid,tmppass);
		} else {
 				new regmsg[256+1];
  				new regname[MAX_PLAYER_NAME+1];
  			GetPlayerName(playerid,regname,MAX_PLAYER_NAME);
  			format(regmsg,256,"Welcome to NY-Roleplay.\n %s\n\nPlease Register!",regname);
				ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"NY-Gaming Register!",regmsg,"Register","Cancel");
				new string[265];
				new idx;
				new tmp[256];
				tmp = strtok(inputtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GREY, "USAGE: /register [password]");
					return 1;
				}
				if (gPlayerAccount[playerid] == 1)
				{
					SendClientMessage(playerid, COLOR_GREY, "  That name is already registered");
					return 1;
				}
				strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(inputtext), 255);
				Encrypt(PlayerInfo[playerid][pPassword]);
				GetPlayerName(playerid, playername, sizeof(playername));
				format(string, sizeof(string), "%s.cer", playername);
				new File: file = fopen(string, io_read);
				if (file)
				{
					SendClientMessage(playerid, COLOR_GREY, "  That name is already registered");
					fclose(file);
					return 1;
				}
				new File:hFile;
				hFile = fopen(string, io_append);
				new var[32];//
    		format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
    		format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
    		format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
    		PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    		format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
				fclose(hFile);
				SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
				SendClientMessage(playerid, COLOR_WHITE, "Next time you connect, type /login <password> to log in.");
				OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
  			}
		}
		return 1; // we processed this. no need for other filterscripts to process it.
	}
	return 0; // we didn't handle anything.
}
Line of the Error:
Код:
	return 0; // we didn't handle anything.



Re: Invalid Function or Declaration! - Rac3r - 13.09.2009

Edit : Ooops, scrap that lol Sorry

Try this :
Код:
  			//}get rid of this
		}
		return 1; // we processed this. no need for other filterscripts to process it.
	}
	return 0; // we didn't handle anything.
}



Re: Invalid Function or Declaration! - Don_Corello - 13.09.2009

Thanks' working Perfectly now but if

if(dialogid == 0) is the ID of the

ShowPlayerDialog(playerid,2,)

Right?

like dialogid == 0 is the id for the Showplayerdialog 2


Re: Invalid Function or Declaration! - UsaBoy91 - 13.09.2009

yes