Register Help (plz help me :( )
#1

hey there i have some problems with my script when ever i go to register it say it register but when i log out and go back in its saying that im not registerd so could someone plz help me out


thx for ur time.

Код:
public OnPlayerConnect(playerid)
{

  new Ip[16]; GetPlayerName(playerid,Name2,sizeof(Name2)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file2,sizeof(file2),PlayerFile,Name2);
	if(!dini_Exists(file2)) {
		dini_Create(file2);
		dini_Set(file2,"Name",Name2);
		dini_Set(file2,"Ip",Ip);
		dini_IntSet(file2,"Registered",-1);
		dini_IntSet(file2,"Password",0);
		dini_IntSet(file2,"Level",0);
		dini_IntSet(file2,"Wired",0);
		dini_IntSet(file2,"Jailed",0);
		dini_IntSet(file2,"Score",0);
		dini_IntSet(file2,"money",0);
		dini_IntSet(file2,"bank",0);
		SendClientMessage(playerid,COLOUR_ORANGE,"You're username is not recognized on this server. Please /register to continue.");
	}
	strcat(gPlayerInfo[playerid][PLAYER_NAME],			dini_Get(file2,"Name"));
	strcat(gPlayerInfo[playerid][PLAYER_IP],			dini_Get(file2,"Ip"));
	gPlayerInfo[playerid][PLAYER_REGGED] 			   = dini_Int(file2,"Registered");
	gPlayerInfo[playerid][PLAYER_PASS]              = dini_Int(file2,"Password");
	gPlayerInfo[playerid][PLAYER_LEVEL] 			   = dini_Int(file2,"Level");
	gPlayerInfo[playerid][PLAYER_WIRED]              = dini_Int(file2,"Wired");
	gPlayerInfo[playerid][PLAYER_JAILED] 			   = dini_Int(file2,"Jailed");
	gPlayerInfo[playerid][PLAYER_SCORE] 			   = dini_Int(file2,"Score");
	gPlayerInfo[playerid][PLAYER_MONEY] 			   = dini_Int(file2,"money");
	
	if(gPlayerInfo[playerid][PLAYER_REGGED] == 0) 	        SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server, but you have not registered. Please /register to continue.");
	else if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)       SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server. Please /login to continue.");
	return 1;
}
public OnPlayerUpdate(playerid)
{
gPlayerInfo[playerid][PLAYER_MONEY] = GetPlayerCash(playerid);
SetPlayerCash(playerid,gPlayerInfo[playerid][PLAYER_MONEY]);
gPlayerInfo[playerid][PLAYER_SCORE] = GetPlayerScore(playerid);
SetPlayerScore(playerid,gPlayerInfo[playerid][PLAYER_SCORE]);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
	gPlayerInfo[playerid][PLAYER_LOGGED] = 0;

  	return 1;
}

dcmd_register(playerid, params[])
{
  if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)
	return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You have already registered!");
  else if(!params[0])
	return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /register [password]");
  /*else if(strlen(params) < gSettings[PASS_MIN] || strlen(params) > gSettings[PASS_MAX])
  {
	new string[200];
    format(string, sizeof(string), "ERROR: Password must be between %d and $d characters long!", gSettings[PASS_MIN], gSettings[PASS_MAX]);
	return SendClientMessage(playerid, COLOUR_ORANGE, string);
  }*/
  else
  {
	new password = num_hash(params);
	gPlayerInfo[playerid][PLAYER_PASS] = password;
	gPlayerInfo[playerid][PLAYER_REGGED] = 1;
    gPlayerInfo[playerid][PLAYER_LOGGED] = 1;
	GetPlayerIp(playerid, gPlayerInfo[playerid][PLAYER_IP], 16);
	new string[256]; format(string, sizeof(string), "You have successfully registered your account with the password \'%s\'. You have been automatically logged in.", params);
	return SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
}
}
dcmd_login(playerid, params[])
{
  if(gPlayerInfo[playerid][PLAYER_REGGED] != 1)
	return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You must register first to do that! Use /register [password] to register and login.");
  else if(gPlayerInfo[playerid][PLAYER_LOGGED] == 1)
	return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You are already logged-in.");
  else if(!params[0])
	return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /login [password]");
  else
  {
	new password = num_hash(params);
	if(gPlayerInfo[playerid][PLAYER_PASS] == password)
	{
	  gPlayerInfo[playerid][PLAYER_LOGGED] = 1;
      GetPlayerIp(playerid, gPlayerInfo[playerid][PLAYER_IP], 16);
	  return SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have successfully logged in to your account.");
	}
	else
	  return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: Incorrect password.");
  }
Reply
#2

yo guys i still need some help coz what it doin is saveing my acount but it wont get the line for my pass so i have to register again so if someon could help out that would be great
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)