Mohamed's Account System
[1.0 - Stable] Miami Land Server Source »

Mohamed

  • Full Member
  • Regards, We3da
  • Posts: 247
Mohamed's Account System
«  »Last edited
Hello, Here Are Sample Account System, I Have Made it, so i love Share it with All!
First Of All, Add it On Your Server.cfg
Code: [Select]
plugins sqlite04rel32 squirrel04rel32 announce04rel32 hashing04rel32 xmlconf04rel32
Then Add it On Your Main.nut
Code: [Select]
// =========================================== S E R V E R   E V E N T S ==============================================

class PlayerClass
{
 Password = null;
 Level = 0;
 Kills = 0;
 Deaths = 0;
 Cash = 0;
 Bank = 0;
 IP = null;
 AutoLogin = false;
 Log = false;
 Reg = false;
}

function onServerStart()
{
}

function onServerStop()
{
}

function onScriptLoad()
{
 SetPassword("");
 SetJoinMessages(true);
 SetServerName( "[0.4] Mohamed's Account System v1.0")
 DataBase <- ConnectSQL("DataBase.db");
 QuerySQL(DataBase, "create table if not exists Accounts ( Name TEXT, LowerName TEXT, Password VARCHAR(255), Level NUMERIC DEFAULT 1, Kills NUMERIC DEFAULT 0, Deaths NUMERIC DEFAULT 0, Cash NUMERIC DEFAULT 0, Bank NUMERIC DEFAULT 0, TimeRegistered VARCHAR(255) DEFAULT CURRENT_TIMESTAMP, IP VARCHAR(255), AutoLogin BOOLEAN DEFAULT true ) ");
 stats <- array(GetMaxPlayers(), null);
 print("Successfully Loaded Mohamed's Registration System.");
}

function onScriptUnload()
{
DisconnectSQL( DataBase );
}

// =========================================== P L A Y E R   E V E N T S ==============================================

function onPlayerJoin( player )
{
Message("[#00CC00]** [#ffffff]"+player.Name+" [#00cc00]Has Joined The Server");
stats[ player.ID ] = PlayerClass();
GetInfo(player);
}

function onPlayerPart( player, reason )
{
if (stats[ player.ID ].Log) SaveStats(player);
}
function onPlayerRequestClass( player, classID, team, skin )
{
return 1;
}

function onPlayerRequestSpawn( player )
{
return 1;
}

function onPlayerSpawn( player )
{
}
function GetStats( player )
{
local q = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
local kills = stats[ player.ID ].Kills, deaths = stats[ player.ID ].Deaths, ratio;
if ( kills >= 1 && deaths >= 1 ) ratio = format( "%.2f", kills.tofloat() / deaths.tofloat() );
else ratio = 0;
Message("[#00CC00]** Status [#ffffff]" + player.Name + " [#00CC00]Kills:[#FFFFFF] " + kills + "[#00CC00] | Death:[#ffffff] " + deaths + "[#00CC00] | Ratio:[#ffffff] " + ratio + "");
Message( "[#00CC00]** Status [#ffffff]" + player.Name + " [#00CC00]TimeRegistered: [#ffffff]" + GetSQLColumnData(q, 8) +  "");
}
function IncCash( player, amount )
{
local cash = stats[ player.ID ].Cash;
local add = cash + amount;
stats[ player.ID ].Cash = add;
player.Cash = add;
}
function DecCash( player, amount )
{
local cash = stats[ player.ID ].Cash;
local det = cash - amount;
stats[ player.ID ].Cash = det;
player.Cash = det;
}
function IncKills( player, amount )
{
local kills = stats[ player.ID ].Kills;
local add = kills + amount;
stats[ player.ID ].Kills = add;
}

function IncKilleds( player, amount )
{
local killeds = stats[ player.ID ].Killeds;
local add = killeds + amount;
stats[ player.ID ].Killeds = add;
}

function IncDeaths( player, amount )
{
local deaths = stats[ player.ID ].Deaths;
local add = deaths + amount;
stats[ player.ID ].Deaths = add;
}
function DecBank( player, amount )
{
local bank = stats[ player.ID ].Bank;
local det = bank - amount;
stats[ player.ID ].Bank = det;
}
function IncBank(player,amount)
{
local bank = stats[ player.ID ].Bank;
local add = bank + amount;
stats[ player.ID ].Bank = add;
}
function onPlayerDeath( player, reason )
{
DecCash( player, 100 );
Announce("Wasted",player,5);

if ( stats[ player.ID ].Level >= 0 )
{
stats[ player.ID ].Deaths ++;
if ( stats[ player.ID ].Cash >= 250 ) DecCash( player, 250 );
}
}
function onPlayerKill( killer, player, reason, bodypart )
{
killer.Score ++;
if ( killer.Health <= 80 ) killer.Health += 20;
if ( reason == 6 ) player.Health = 100;
if ( stats[ killer.ID ].Level >= 1 && stats[ player.ID ].Level == 0 )
{
stats[ killer.ID ].Kills ++;
IncCash( killer, 15000 );
}
if ( stats[ killer.ID ].Level == 0 && stats[ player.ID ].Level >= 0 )
{
stats[ player.ID ].Deaths ++;
if ( stats[ player.ID ].Cash >= 250 ) DecCash( player, 250 );
}
if ( stats[ killer.ID ].Level >= 1 && stats[ player.ID ].Level >= 0 )
{
stats[ killer.ID ].Kills ++;
stats[ player.ID ].Deaths ++;
IncCash( killer, 15000 );
if ( stats[ player.ID ].Cash >= 250 ) DecCash( player, 250 );
}
}
function onPlayerTeamKill( player, killer, reason, bodypart )
{
}

function onPlayerChat( player, text )
{
return 1;
}

function onPlayerCommand( player, cmd, text )
{
if ( cmd == "cmds" || cmd == "command"|| cmd == "commands")
{
  MessagePlayer("[#00CC00]** /register, /login, /logout, /changepass" , player);
  MessagePlayer("[#00CC00]** /stats" , player);
  }
 else if (cmd == "credits")
 {
  MessagePlayer("[#00CC00]** Scripter By [#ffffff][AFt]We3da^" , player);
  MessagePlayer("[#00CC00]** Account System: [#ffffff][AFt]We3da^" , player);
  }

else if(cmd == "exec")
{
if ( stats[ player.ID ].Level < 10 ) MessagePlayer("[ERROR][#ffffff] Un Authorized Acces",player);
else if( !text ) MessagePlayer( "[#00CC00]** Syntax, /exec <Squirrel code>", player);
else
{
try
{
local script = compilestring( text );
script();
}
catch(e) MessagePlayer( "Error: " + e, player);
}
return 1;
}
else if ( cmd == "stats" )
{
if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[#00CC00]** You're Not Registered.", player );
else if ( stats[ player.ID ].Log == false ) return MessagePlayer( "[#00CC00]** You're Not Logged-In.", player );
else if ( !text ) GetStats( player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "[#00CC00]** Unknow Player.", player );
else if ( stats[ plr.ID ].Reg == false ) return MessagePlayer( "[#00CC00]** The Player Are Not Registered.", player );
else if ( stats[ plr.ID ].Log == false ) return MessagePlayer( "[#00CC00]** The Player Are Not logged-In.", player );
else if ( plr.ID == player.ID ) GetStats( player );
else GetStats( plr );
}
}
 else if (cmd == "changepass")
 {
 if ( stats[ player.ID ].Log == false ) return MessagePlayer( "[ERROR][#ffffff] You're Not Logged-In.", player );
 else if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[ERROR][#ffffff] You're Not Registered.", player );
 else if ( !text ) MessagePlayer("[#00CC00]** Syntax, /changepass <NewPass>",player);
 else {
 local password = SHA256(text);
 QuerySQL(DataBase, "UPDATE Accounts SET Password = '" + password + "' WHERE Name = '" + escapeSQLString(player.Name) + "'");
 MessagePlayer("[#00CC00]** Successfully Changed Password To [#ffffff]"+text+" [#00CC00]Don't Forget It",player);
 }
 }
 else if (cmd == "logout")
 {
 if ( !player.IsSpawned ) MessagePlayer("[ERROR][#ffffff] You Must Be Spawn First",player);
 else {
  QuerySQL(DataBase, "UPDATE Accounts SET AutoLogin = '" + false + "' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#00CC00]** Successfully Logout",player);
  stats[ player.ID ].AutoLogin = false;
  stats[ player.ID ].Log = false;
  player.Health = 0;
  }
  }
 else if (cmd == "register")
 {
  if ( stats[ player.ID ].Log == true ) return MessagePlayer( "[#00CC00]** You're already logged in & registered.", player );
  else if ( stats[ player.ID ].Reg == true ) return MessagePlayer( "[#00CC00]** You're already register.", player );
  else if ( !text ) MessagePlayer("[#00CC00]** Syntax, /register [password]",player);
  else
  {
  local now = date();
  local password = SHA256(text);
  QuerySQL( DataBase, "INSERT INTO Accounts ( Name, LowerName, Password, Level, Kills, Deaths, Cash, Bank, TimeRegistered, IP, AutoLogin ) VALUES ( '" + escapeSQLString(player.Name) + "','" + escapeSQLString(player.Name) + "','" + password + "', '" + 1 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '"+ now.year +"/"+now.month+"/"+now.day+"/"+now.hour+":"+ now.min + "', '" + player.IP + "', '" + true + "' )" );
  MessagePlayer("[#00CC00]** Successfully Registered, Password: [#ffffff]"+text+"",player);
  player.Cash = stats[ player.ID ].Cash;
  stats[ player.ID ].Reg = true;
  stats[ player.ID ].Log = true;
  stats[ player.ID ].Level = 1;
  stats[ player.ID ].Kills = 0;
  stats[ player.ID ].Deaths = 0;
  stats[ player.ID ].Cash = 0;
  stats[ player.ID ].Bank = 0;
  stats[ player.ID ].IP = player.IP;
  stats[ player.ID ].AutoLogin = true;
 }
 }
 else if (cmd == "login")
 {
   if ( stats[ player.ID ].Log == true ) return MessagePlayer( "[ERROR][#ffffff] You're already logged in", player );
   if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[ERROR][#ffffff] You're not register.", player );
   if ( !text ) return MessagePlayer( "[#00CC00]** Syntax, /login [password]", player );
   if ( SHA256(text) != GetPass( player ) ) return MessagePlayer( "[#00CC00]** Invalid Password", player );

   player.Cash = stats[ player.ID ].Cash;
   stats[ player.ID ].Log = true;
   stats[ player.ID ].Reg = true;
   MessagePlayer("[#00CC00]** You Have Logged-In Successfully.",player);
   QuerySQL(DataBase, "UPDATE Accounts SET AutoLogin = '" + true + "' WHERE Name = '" + player.Name + "'");
   stats[ player.ID ].AutoLogin = true;
   stats[ player.ID ].IP = player.IP;
 return;
   }
 
 
 else MessagePlayer("[#00CC00]** Unknow Command Use [#ffffff]/cmds [#00CC00]For Command Server",player);
}
function onPlayerPM( player, playerTo, message )
{
return 1;
}

function onPlayerBeginTyping( player )
{
}

function onPlayerRequestSpawn(player)
{
 if (!stats[ player.ID ].Reg) MessagePlayer("[#00CC00]** Please Register First.", player);
 else if (!stats[ player.ID ].Log) MessagePlayer("[#00CC00]** Please Login First.", player);
 else return 1;
}

function onPlayerEndTyping( player )
{
}

/*
function onLoginAttempt( player )
{
return 1;
}
*/

function onNameChangeable( player )
{
}

function onPlayerSpectate( player, target )
{
}

function onPlayerCrashDump( player, crash )
{
}

function onPlayerMove( player, lastX, lastY, lastZ, newX, newY, newZ )
{
}

function onPlayerHealthChange( player, lastHP, newHP )
{
}

function onPlayerArmourChange( player, lastArmour, newArmour )
{
}

function onPlayerWeaponChange( player, oldWep, newWep )
{
}

function onPlayerAwayChange( player, status )
{
}

function onPlayerNameChange( player, oldName, newName )
{
}

function onPlayerActionChange( player, oldAction, newAction )
{
}

function onPlayerStateChange( player, oldState, newState )
{
}

function onPlayerOnFireChange( player, IsOnFireNow )
{
}

function onPlayerCrouchChange( player, IsCrouchingNow )
{
}

function onPlayerGameKeysChange( player, oldKeys, newKeys )
{
}

// ========================================== V E H I C L E   E V E N T S =============================================

function onPlayerEnteringVehicle( player, vehicle, door )
{
return 1;
}

function onPlayerEnterVehicle( player, vehicle, door )
{
}

function onPlayerExitVehicle( player, vehicle )
{
}

function onVehicleExplode( vehicle )
{
}

function onVehicleRespawn( vehicle )
{
}

function onVehicleHealthChange( vehicle, oldHP, newHP )
{
}

function onVehicleMove( vehicle, lastX, lastY, lastZ, newX, newY, newZ )
{
}

// =========================================== P I C K U P   E V E N T S ==============================================

function onPickupClaimPicked( player, pickup )
{
return 1;
}

function onPickupPickedUp( player, pickup )
{
}

function onPickupRespawn( pickup )
{
}

// ========================================== O B J E C T   E V E N T S ==============================================

function onObjectShot( object, player, weapon )
{
}

function onObjectBump( object, player )
{
}

// =========================================== B I N D   E V E N T S ==============================================

function onKeyDown( player, key )
{
}

function onKeyUp( player, key )
{
}
function GetInfo(player)
{
 local q = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
 if (q)
 {
  stats[ player.ID ].Password = GetSQLColumnData(q, 2);
  stats[ player.ID ].Level = GetSQLColumnData(q, 3);
  stats[ player.ID ].Kills = GetSQLColumnData(q, 4);
  stats[ player.ID ].Deaths = GetSQLColumnData(q, 5);
  stats[ player.ID ].Cash = GetSQLColumnData(q, 6);
  stats[ player.ID ].Bank = GetSQLColumnData(q, 7);
  stats[ player.ID ].IP = GetSQLColumnData(q, 9);
  stats[ player.ID ].AutoLogin = GetSQLColumnData(q, 10);
  stats[ player.ID ].Reg = true;
  if (player.IP == stats[ player.ID ].IP)
  {
   if (stats[ player.ID ].AutoLogin == "true")
   {
    MessagePlayer("[#00CC00]** Welcome back To The Server", player);
    MessagePlayer("[#00CC00]** [#ffffff]"+player.Name+" [#00CC00]Auto Logged-In", player);
    player.Cash = stats[ player.ID ].Cash;
    stats[ player.ID ].Log = true;
   }
   else
   {
    MessagePlayer("[#00CC00]** Welcome back To The Server", player);
    MessagePlayer("[#00CC00]** You're Already Registered, Please Use [#ffffff]/Login [#00CC00]To Acces.", player);
   }
  }
  else
  {
   MessagePlayer("[#00CC00]** Welcome back To The Server", player);
   MessagePlayer("[#00CC00]** You're Already Registered, Please Use [#ffffff]/Login [#00CC00]To Acces.", player);
  }
 }
 else
 {
  MessagePlayer("[#00CC00]** Welcome back To The Server", player);
  MessagePlayer("[#00CC00]** Your Name Are Not In DataBase, Please Use [#ffffff]/Register [#00CC00]To Add Your Nick To DataBase.", player);
 }
 FreeSQLQuery(q);
}

function SaveStats(player)
{
QuerySQL( DataBase, "UPDATE Accounts SET Level='"+stats[ player.ID ].Level+"',IP='"+stats[ player.ID ].IP+"',Kills='"+stats[ player.ID ].Kills+"',Deaths='"+stats[ player.ID ].Deaths+"',Cash='"+stats[ player.ID ].Cash+"',Bank='"+stats[ player.ID ].Bank+"',AutoLogin='"+stats[ player.ID ].AutoLogin+"' WHERE Name LIKE '" + player.Name + "'" );
}
function GetPass( player )
 {
 local result = GetSQLColumnData( QuerySQL( DataBase, "SELECT Password FROM Accounts WHERE Name='"+player.Name+"'" ), 0 );
 if ( result ) return result;
 else return 0;
 }
 
function rotateRight(val, sbits)
 {
 return (val >> sbits) | (val << (0x20 - sbits));
 }
 
function e( string )
 {
 local hp =
   [
   0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
   0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
   ];

 local k =
   [
   0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
   0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
   0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
   0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
   0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
   0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
   0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
   0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
   ];

 local
   w   = array( 64 ),
   i   = 0,
   s   = 0,
   len = string.len( ),
   word_array = array( 0 );

 for( i = 0; i < len - 3; i += 4 )
  {
  word_array.push( string[i] << 0x18 | string[i + 1] << 0x10 | string[i + 2] << 0x08 | string[i + 3] );
  }

 switch( len % 4 )
  {
   case 0:
    i = 0x80000000;
    break;
   case 1:
    i = string[len - 1] << 0x18 | 0x80000000;
    break;
   case 2:
    i = string[len - 2] << 0x18 | string[len - 1] << 0x10 | 0x08000;
    break;
   case 3:
    i = string[len - 3] << 0x18 | string[len - 2] << 0x10 | string[len - 1] << 0x08 | 0x80;
    break;
  }
 word_array.push( i );

 while( ( word_array.len() % 0x10 ) != 0x0E )
   word_array.push( 0 );
   
 word_array.push( len >> 0x10 );
 word_array.push( ( len << 0x03 ) & 0xFFFFFFFF );

 local s0, s1;
 for( s = 0; s < word_array.len(); s += 0x10 )
   {
   for( i = 0x00; i < 0x10; i++ )
    w[i] = word_array[s + i];

   for( i = 0x10; i < 0x40; i++ )
    {
    s0 = rotateRight( w[i - 15], 7 ) ^ rotateRight( w[i - 15], 18 ) ^ ( w[i - 15] >> 3 );
    s1 = rotateRight( w[i - 2], 17 ) ^ rotateRight( w[i - 2], 19 ) ^ ( w[i - 2] >> 10 );
    w[i] = w[i - 0x10] + s0 + w[i - 7] + s1;
     }

   local a = hp[0],
    b = hp[1],
    c = hp[2],
    d = hp[3],
    e = hp[4],
    f = hp[5],
    g = hp[6],
    h = hp[7];

   for( i = 0x00; i < 0x40; i++ )
   {
    s0 = ( rotateRight( a, 2 ) ^ rotateRight( a, 13 ) ^ rotateRight( a, 22 ) );
    local maj = ( ( a & b ) ^ ( a & c ) ^ ( b & c ) );
    local t2  = ( s0 + maj );
    s1 = ( rotateRight( e, 6 ) ^ rotateRight( e, 11) ^ rotateRight( e, 25 ) );
    local ch  = ( ( e & f ) ^ ( ( ~e ) & g ) );
    local t1  = ( h + s1 + ch + k[i] + w[i] );

    h = g;
    g = f;
    f = e;
    e = d + t1;
    d = c;
    c = b;
    b = a;
    a = t1 + t2;
   }

   hp[0] += a;
   hp[1] += b;
   hp[2] += c;
   hp[3] += d;
   hp[4] += e;
   hp[5] += f;
   hp[6] += g;
   hp[7] += h;
  }

 local hash = format
   (
   "%08x%08x%08x%08x%08x%08x%08x%08x",
   hp[0],
   hp[1],
   hp[2],
   hp[3],
   hp[4],
   hp[5],
   hp[6],
   hp[7]
   );

 return hash;
 }

// ================================== E N D   OF   O F F I C I A L   E V E N T S ======================================
Good Luck Scripting
Feel Free To PM Me For Any Support, I'm Care.
Anyway u can Contact Me Ingame!
Ingame Name: [AFt]We3da^
My Own Server: ViceEvil Server

Ali Ahmed

  • Full Member
  • Why so rude,be more rude
  • Posts: 103
Re: Mohamed's Account System
« Reply #2,  »Last edited
You should remove the IptoCountry because I bet that someone will copy paste entirely and s/he will get errors.
You should post this in portions telling what to put where, It makes it easier
Need some Help pm me.Wanna see my server the name is Pakistan Theft Auto Reloaded

Mohamed

  • Full Member
  • Regards, We3da
  • Posts: 247
Re: Mohamed's Account System
« Reply #3,  »
Quote from Ali Ahmed on February 18th, 2018, 03:22 AM
You should remove the IptoCountry because I bet that someone will copy paste entirely and s/he will get errors.
You should post this in portions telling what to put where, It makes it easier
Oh ya i forget to add link of ip to country anyway will update soon.
thanks.
Feel Free To PM Me For Any Support, I'm Care.
Anyway u can Contact Me Ingame!
Ingame Name: [AFt]We3da^
My Own Server: ViceEvil Server

Mahmoud Tornado

  • Full Member
  • Posts: 220
Re: Mohamed's Account System
« Reply #5,  »
Just change this!

In /Changepass and /Register too.
From:
Code: [Select]
local password = e(text);
To:
Code: [Select]
local password = SHA256(text);

In /Login
From:
Code: [Select]
  if ( e(text) != GetPass( player ) ) return MessagePlayer( "[#00CC00]** Invalid Password", player );
To:
Code: [Select]
   if ( SHA256(text) != GetPass( player ) ) return MessagePlayer( "[#00CC00]** Invalid Password", player );

Mohamed

  • Full Member
  • Regards, We3da
  • Posts: 247
Re: Mohamed's Account System
« Reply #6,  »
Quote from Mahmoud Tornado on March 15th, 2018, 11:41 PM
Just change this!

In /Changepass and /Register too.
From:
Code: [Select]
local password = e(text);
To:
Code: [Select]
local password = SHA256(text);

In /Login
From:
Code: [Select]
  if ( e(text) != GetPass( player ) ) return MessagePlayer( "[#00CC00]** Invalid Password", player );
To:
Code: [Select]
   if ( SHA256(text) != GetPass( player ) ) return MessagePlayer( "[#00CC00]** Invalid Password", player );
Also the old its work only a one problem.
Anyone thanks Updated.
Feel Free To PM Me For Any Support, I'm Care.
Anyway u can Contact Me Ingame!
Ingame Name: [AFt]We3da^
My Own Server: ViceEvil Server

Ali Ahmed

  • Full Member
  • Why so rude,be more rude
  • Posts: 103
Need some Help pm me.Wanna see my server the name is Pakistan Theft Auto Reloaded

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 448
Re: Mohamed's Account System
« Reply #9,  »
SO NICEEE UPDATED? IT

i hope bug in loogut.

i /logout i m dead. and if i do /login my password invalidd password
Re: Mohamed's Account System
« Reply #10,  »
Bro u can give me Admin system ...

and cash system?

their is cash system in this?

Update it,. and woowww nice soo niece :DD
Try to UnderStand ME!

Mohamed

  • Full Member
  • Regards, We3da
  • Posts: 247
Re: Mohamed's Account System
« Reply #11,  »
Quote from =RK=MarineForce on March 23rd, 2018, 09:58 AM
Bro u can give me Admin system ...

and cash system?

their is cash system in this?

Update it,. and woowww nice soo niece :DD
Yes That its Saved Stats & Cash & Bank & All things check /exec for command level.
Like That ;)
Code: [Select]
if ( stats[ player.ID ].Level < 10 ) MessagePlayer("[ERROR][#ffffff] Un Authorized Acces",player);
Feel Free To PM Me For Any Support, I'm Care.
Anyway u can Contact Me Ingame!
Ingame Name: [AFt]We3da^
My Own Server: ViceEvil Server

Mahmoud Tornado

  • Full Member
  • Posts: 220
Re: Mohamed's Account System
« Reply #12,  »Last edited
Quote from =RK=MarineForce on March 23rd, 2018, 09:57 AM
SO NICEEE UPDATED? IT

i hope bug in loogut.

i /logout i m dead. and if i do /login my password invalidd password
Change your register command with this.
Code: [Select]
else if (cmd == "register")
 {
  if ( Stats[ player.ID ].Log == true ) return MessagePlayer( "[#00de00]Information: [#fbf3f3]You're already logged in & registered.", player );
  else if ( Stats[ player.ID ].Reg == true ) return MessagePlayer( "[#00de00]Information: [#fbf3f3]You're already register.", player );
  else if ( !text ) MessagePlayer("[#00de00]Information: [#fbf3f3]Syntax, /register [password]",player);
  else
  {
  local now = date();
  local password = SHA256(text);
  QuerySQL( DataBase, "INSERT INTO Accounts ( Name, LowerName, Password, Level, Kills, Deaths, Cash, Bank, TimeRegistered, IP, AutoLogin ) VALUES ( '" + escapeSQLString(player.Name) + "','" + escapeSQLString(player.Name) + "','" + password + "', '" + 1 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '"+ now.year +"/"+now.month+"/"+now.day+"/"+now.hour+":"+ now.min + "', '" + player.IP + "', '" + true + "' )" );
  MessagePlayer("[#00de00]Information: [#fbf3f3]Successfully Registered, Password: [#ffffff]"+text+"",player);
  player.Cash = Stats[ player.ID ].Cash;
  Stats[ player.ID ].Reg = true;
  Stats[ player.ID ].Log = true;
  Stats[ player.ID ].Level = 1;
  Stats[ player.ID ].Kills = 0;
  Stats[ player.ID ].Deaths = 0;
  Stats[ player.ID ].Cash = 0;
  Stats[ player.ID ].Bank = 0;
  Stats[ player.ID ].IP = player.IP;
  Stats[ player.ID ].AutoLogin = true;
 }
 }

and you logout problem
Code: [Select]
else if (cmd == "logout")
 {
 if ( !player.IsSpawned ) MessagePlayer("[ERROR][#ffffff] You Must Be Spawn First",player);
 else {
  QuerySQL(DataBase, "UPDATE Accounts SET AutoLogin = '" + false + "' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#00CC00]** Successfully Logout",player);
  stats[ player.ID ].AutoLogin = false;
  stats[ player.ID ].Log = false;
  }
  }

Mohamed

  • Full Member
  • Regards, We3da
  • Posts: 247
Re: Mohamed's Account System
« Reply #13,  »
Updated. In First Post
The Problem was in Savestats.
All Bugs Fixed. You can Re-Install the Account & All thing will Work.
Good Luck.
Feel Free To PM Me For Any Support, I'm Care.
Anyway u can Contact Me Ingame!
Ingame Name: [AFt]We3da^
My Own Server: ViceEvil Server

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 448
Re: Mohamed's Account System
« Reply #14,  »
AddClass( 1, RGB( 255, 255, 3 ) ,0,Vector( 583.553 -1121.18 12.3375 ), 0.0256715, 21, 999 ,26, 999, 22, 400 );

ON SCRIPT LOAD LINE 27
Try to UnderStand ME!