missing?
#1

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
	new file[29];
	new tmp[100];
	new tmp2[256];
 	
 	if(dialogid == 1) // Register Dialog
 	{
		format(file,sizeof(file),"/KA/Users/%s.sav",udb_encode(name));
  	if(!fexist(file))
  	{
  	dini_Create(file);
  	dini_IntSet(file, "Password", udb_hash(tmp));
  	dini_IntSet(file,"AdminLevel", 0);
  	dini_IntSet(file,"Cash", 500);
  	dini_IntSet(file,"Registered", 1);
  	SendClientMessage(playerid, COLOR_GREEN, "[System]: Account Created!");
  	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  	printf("%s has registered a account!", name);
  	}
  	else
		{
		SendClientMessage(playerid, COLOR_GREEN, " Account Already Found In Database");
		PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		return 1;
		}
	}
  if(dialogid == 2) // Login Dialog
	{
		if(IsLogged[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_GREEN, "You already are logged in!");
			return 1;
		}
		else
		{
			format(file,sizeof(file),"/KA/Users/%s.sav",udb_encode(name[playerid]));
			if(fexist(file))
			{
			tmp2 = dini_Get(file, "Password");
			if(udb_hash(tmp) != strval(tmp2))
			{
			SendClientMessage(playerid, COLOR_GREEN, "Login Failed!");
  			GetPlayerName(playerid, name, sizeof(name));
		  printf("%s has failed to login", name);
		  }
		  else
		  {
		  IsLogged[playerid] = 1;
	 		SetPlayerMoney(playerid, dini_Int(file, "Cash"));
			PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
			PlayerInfo[playerid][Registered] = dini_Int(file, "Registered");
			SendClientMessage(playerid, COLOR_GREEN, "[System]: Account Logged into!");
			}
			return 1;
		}
	}
	}
	return 1;
}
what i missing in my dialog /register , /login system ? i know it have some mistakes but i dont know what to fix to make it better it is just converted from dini tut how to make adminsystem --> http://forum.sa-mp.com/index.php?topic=126584.0 -dini saving system/register

ty for any help
Reply
#2

anyone please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)