Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - SilentX

#1
Need some help here i've been struggling
when i use register command , it does register the account , the account also gets saved on the database with player's nick, but if player rejoin server , it will ask him to register again, and if it does then it'll just create another account on database with same nick, but problem still there , every time player joins the server it will ask him to re register again and again

if ( cmd == "register" )
  {
   if ( db_account[ player.ID ].Registed == true ) ePrivMessage( "[Error] - You're Already Registered!", player );
   else if ( !text ) ePrivMessage( "[Syntax] - /" + cmd + " <Password>", player );
   else
   {
        Register( player, text );
}
}


function Register( player, password )
{
    local pass = ::SHA256(password);
QuerySQL( db, "INSERT INTO Account ( Name, IP, Level, Pass, Kills, Deaths, Cash, Bank, Joins, nogoto, DateRegistered, WonLMS, RandSpawn ) VALUES ( '" + player.Name.tolower() + "', '" + player.IP + "', 1, '" + pass + "', 0, 0, 0, 0, 0, 'off', '" + GetFullTime() + "', 0, 'on' )" );
db_account[ player.ID ].Logged = true;
db_account[ player.ID ].Reg = true;
ClientMessage(  " Congratz , your account is been successfully registered", player,250,107,222 );
ClientMessage( " Remember your pass: [#FFFFFF][" + password + "]", player,250,107,222  );
ClientMessage( " you have recived 1000 cash", player,250,107,222  );
IncCash( player, 1000 );

}

function IncCash( player, amount )
{
      local cash = db_account[ player.ID ].Cash;
  local add = cash + amount;
  db_account[ player.ID ].Cash = add;
  player.Cash = add;
}