few simple errors I need help with.
#1

So I'm making a register system but I bumped into few errors

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == dialogregister)
  {
	  if(!response) return Kick(playerid);
	  if(response)
	  {
	 	ShowPlayerDialog(playerid, dialogregister, DIALOG_STYLE_INPUT, "Server", "Welcome to LSDB!\nThis account is NOT registered\nPlease insert your password below in order to create an account.", "Register", "Quit");
        return 1;
	  }
	  new hashpass[129];
	  WP_Hash(hashpass, sizeof(hashpass), inputtext);
	  new INI:file = INI_Open(Path(playerid));
	  INI_SetTag(file, "Player Information");
	  INI_WriteString(file, "Password", hashpass);
	  INI_WriteInt(file, "AdminLevel", 0);
	  INI_WriteInt(file, "Money", 100);
	  INI_WriteInt(file, "Score", 0);
	  INI_WriteInt(file, "Kills", 0);
	  INI_WriteInt(file, "Deaths", 0);
	  INI_Close(file);
	  SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have successfully registered an account!");
	  return 1;
	}
	return 1;

 }
	  if(dialogid == dialoglogin)
	  {
		 if(!response) return Kick(playerid);
		 if(response)
		 {
			 WP_Hash(hashpass, sizeof(hashpass), inputtext);
			 if(!strcmp(hashpass, pInfo[playerid][Pass], false))
			 {
				INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
				SetPlayerScore(playerid, pInfo[playerid][Score]);
				GivePlayerMoney(playerid, pInfo[playerid][Money]);
				SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have successfully logged in! You can start playing now.");
			 }
			 else
			 {
				ShowPlayerDialog(playerid, dialoglogin, DIALOG_STYLE_INPUT, "Server", "{FF0000}You have entered an invalid password!\nPlease retry again.","Login","Quit");
				return 1;
			 }
		 }
	}
	return 1;
}
Код:
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(105) : warning 217: loose indentation
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(108) : error 010: invalid function or declaration
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(110) : error 010: invalid function or declaration
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(111) : error 010: invalid function or declaration
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(114) : error 010: invalid function or declaration
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(116) : error 021: symbol already defined: "INI_ParseFile"
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(116) : error 017: undefined symbol "playerid"
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(116) : error 010: invalid function or declaration
C:\Users\yan\Desktop\SA-MP Server\filterscripts\RegisterSystem.pwn(116 -- 121) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
So all errors are on these lines

Код:
 if(dialogid == dialoglogin)
	  {
		 if(!response) return Kick(playerid);
		 if(response)
		 {
			 WP_Hash(hashpass, sizeof(hashpass), inputtext);
			 if(!strcmp(hashpass, pInfo[playerid][Pass], false))
			 {
				INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
Reply
#2

You had an unmatched bracket after the register dialog.

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == dialogregister)
	{
		if(!response) return Kick(playerid);
		if(response)
		{
			ShowPlayerDialog(playerid, dialogregister, DIALOG_STYLE_INPUT, "Server", "Welcome to LSDB!\nThis account is NOT registered\nPlease insert your password below in order to create an account.", "Register", "Quit");
			return 1;
		}
		new hashpass[129];
		WP_Hash(hashpass, sizeof(hashpass), inputtext);
		new INI:file = INI_Open(Path(playerid));
		INI_SetTag(file, "Player Information");
		INI_WriteString(file, "Password", hashpass);
		INI_WriteInt(file, "AdminLevel", 0);
		INI_WriteInt(file, "Money", 100);
		INI_WriteInt(file, "Score", 0);
		INI_WriteInt(file, "Kills", 0);
		INI_WriteInt(file, "Deaths", 0);
		INI_Close(file);
		SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have successfully registered an account!");
		return 1;

	}
	if(dialogid == dialoglogin)
	{
		if(!response) return Kick(playerid);
		if(response)
		{
			WP_Hash(hashpass, sizeof(hashpass), inputtext);
			if(!strcmp(hashpass, pInfo[playerid][Pass], false))
			{
				INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
				SetPlayerScore(playerid, pInfo[playerid][Score]);
				GivePlayerMoney(playerid, pInfo[playerid][Money]);
				SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have successfully logged in! You can start playing now.");
			}
			else
			{
				ShowPlayerDialog(playerid, dialoglogin, DIALOG_STYLE_INPUT, "Server", "{FF0000}You have entered an invalid password!\nPlease retry again.","Login","Quit");
				return 1;
			}
		}
		return 1;
	}
	return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}
+ I think your register dialog is wrong!

It should be:

Код:
if(dialogid == dialogregister)
{
	if(!response) return Kick(playerid);
	if(response) 
	{
		new hashpass[129];
		WP_Hash(hashpass, sizeof(hashpass), inputtext);
		new INI:file = INI_Open(Path(playerid));
		INI_SetTag(file, "Player Information");
		INI_WriteString(file, "Password", hashpass);
		INI_WriteInt(file, "AdminLevel", 0);
		INI_WriteInt(file, "Money", 100);
		INI_WriteInt(file, "Score", 0);
		INI_WriteInt(file, "Kills", 0);
		INI_WriteInt(file, "Deaths", 0);
		INI_Close(file);
		SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You have successfully registered an account!");
	}
	return 1;
}
Reply
#3

I just followed newbienoob's tutorial, I'll try yours though..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)