[RLC] Register, Login & Change Password v-0.2
[Commands] Some Command For Cars »

!

  • Sr. Member
  • Don't feel shy while zooming on h*r... >>zeus#5155
  • Posts: 380
[RLC] Register, Login & Change Password v-0.2
« on September 15th, 2017, 08:44 AM »Last edited
Update Reason: Used vcmp official hashing, unique id concept has been used and installation is made simple.

Commands:
Code: [Select]
   -> /commands
   -> /register <password>
   -> /login <password>
   -> /changepass <old-password> <new-password>

Installation: Download the file rlc.nut from the link and place it inside svr_dir and place the bellow functions in appropriate server events.

onScriptLoad()
Code: [Select]
/* onScriptLoad() */
dofile( "rlc.nut", true );
rlc_table.onScriptLoad( );

onPlayerJoin( player )
Code: [Select]
/* onPlayerJoin( player ) */
rlc_table.onPlayerJoin( player );

onPlayerPart( player, reason )
Code: [Select]
/* onPlayerPart( player, reason ) */
rlc_table.onPlayerPart( player );

onPlayerCommand( player, command, arguments )
Code: [Select]
/* onPlayerCommand( player, command, arguments ) */
switch( command ) {
 case "register":
 case "login":
 case "changepass":
    rlc_table.onPlayerCommand( player, command, arguments );
 break;
 case "commands":
    MessagePlayer( "[#7bb215][RLC] [#15a26f]RLC Commands: [/] register, login, changepass.", player );
 break;
 default:
    MessagePlayer( "[#7bb215][RLC] [#cc3510](ERROR) Invalid command, use /commands to check for availble commands.", player );
}


Github: Link

Discord: zeus#5155

Mahmoud Tornado

  • Full Member
  • Posts: 220
Re: Basic Login/Registeration System
« Reply #3, on September 15th, 2017, 05:33 PM »
i think the problem here
Code: [Select]
//Functions

function Login( player, pass )
{
local q = QuerySQL( DataBase, "SELECT * FROM Account WHERE Name LIKE '" + player.Name + "'" );
local Clan = GetSQLColumnData( q, 2 );
Stats[ player.ID ].Reg = true;
Stats[ player.ID ].Log = true;
local q = QuerySQL( DataBase, "SELECT Cash, Bank, Kills, Deaths FROM Account WHERE Name LIKE '" + player.Name + "'" );
if (!q) return MessagePlayer( "Data is not loaded, your nick is not found in database.", player );

Stats[ player.ID ].Cash = GetSQLColumnData( q, 0 );
Stats[ player.ID ].Bank = GetSQLColumnData( q, 1 );
Stats[ player.ID ].Kills = GetSQLColumnData( q, 2 );
Stats[ player.ID ].Deaths = GetSQLColumnData( q, 3 );
FreeSQLQuery( q );
local w = QuerySQL( Clans, "SELECT * FROM ClanMembersRequest WHERE Player LIKE '" + player.Name + "' COLLATE NOCASE" );
if (w)
{
Stats[ player.ID ].ClanRequest = true;
Stats[ player.ID ].ClaneTag = GetSQLColumnData( w, 1 );
Stats[ player.ID ].Clane = GetSQLColumnData( w, 2 );
Stats[ player.ID ].ClaneState = GetSQLColumnData( w, 3 );
MessagePlayer( "[#00de00]Clan Request: [#fbf3f3]Clan [ " + Stats[ player.ID ].Clane + " ].Use /acceptclan or /rejectclan.",player);
}
FreeSQLQuery( w );

if ( Clan != "None" )
{
local r = QuerySQL( Clans, "SELECT Tag FROM ClanStats WHERE Clan LIKE '"+Clan+"'" );
if (r)
{
local
Tag = GetSQLColumnData( r, 0 ),
t = QuerySQL( Clans, "SELECT * FROM ClanMembers WHERE Clan LIKE '"+Clan+"'" ),
Owner = GetSQLColumnData( t, 1 ),
Leader1 = GetSQLColumnData( t, 2 ),
Leader2 = GetSQLColumnData( t, 3 ),
Leader3 = GetSQLColumnData( t, 4 ),
Users = GetSQLColumnData( t, 5 );
if ( Owner == player.Name )
{
Stats[ player.ID ].Clan = Clan;
Stats[ player.ID ].ClanTag = Tag;
Stats[ player.ID ].ClanState = "Owner";
}
if ( Leader1 == player.Name )
{
Stats[ player.ID ].Clan = Clan;
Stats[ player.ID ].ClanTag = Tag;
Stats[ player.ID ].ClanState = "Leader1";
}
if ( Leader2 == player.Name )
{
Stats[ player.ID ].Clan = Clan;
Stats[ player.ID ].ClanTag = Tag;
Stats[ player.ID ].ClanState = "Leader2";
}
if ( Leader3 == player.Name )
{
Stats[ player.ID ].Clan = Clan;
Stats[ player.ID ].ClanTag = Tag;
Stats[ player.ID ].ClanState = "Leader3";
}
if ( Users.find( player.Name ) )
{
Stats[ player.ID ].Clan = Clan;
Stats[ player.ID ].ClanTag = Tag;
Stats[ player.ID ].ClanState = "Users";
}
FreeSQLQuery(t);
}
FreeSQLQuery(r);
}

CheckPlayerClan( player );
MessagePlayer("[#00de00]Server Msg: [#fbf3f3]Welcome Back.",player);
MessagePlayer("[#00de00]Server Msg: [#fbf3f3]You Have Logged-In Successfully.",player);
}

function Register( player, password )
{
local pass = e(password);
QuerySQL( DataBase, "INSERT INTO Account ( Name, Pass, Clan, Cash, Bank, Kills, Deaths ) VALUES ( '" + player.Name + "', '" + pass + "', 'None'', '0', '0', '0', '0' )" );

Stats[ player.ID ].Log = true;
Stats[ player.ID ].Reg = true;
MessagePlayer("[#00de00]Server Msg: [#fbf3f3]Nick: " + player.Name + ". Password: " + password + ".",player);
MessagePlayer( "[#00de00]Server Msg: [#fbf3f3]You Have Successfully Register.", player );
}

!

  • Sr. Member
  • Don't feel shy while zooming on h*r... >>zeus#5155
  • Posts: 380

Discord: zeus#5155

Ðℯαтℌ ℳαṧт℮я

  • Newbie
  • --- Em no tsurt t'nod ---
  • Posts: 7

[SC]Spartan

  • Newbie
  • Posts: 25
Re: Basic Login/Registeration System
« Reply #6,  »
Could you please add a system that changes the player's nickname and writes it to the database?

KrooB

  • Full Member
  • BEN TÜRKÜM
  • Posts: 117
Re: Basic Login/Registeration System
« Reply #7,  »
Try this

Code: [Select]
else if (cmd == "isimdegis")
 {
 if ( stats[ player.ID ].Log == false ) return MessagePlayer( "[#E0E0E0]Sunucuya giris yapmaniz gerek", player );
 else if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[#E0E0E0]Sunucuya kayit olmaniz gerek", player );
 else if ( !text ) MessagePlayer("[#E0E0E0]Kod: /isimdegis <Yeniisim>",player);
 else {
 local name = VARCHAR(25);
 QuerySQL(DataBase, "UPDATE Accounts SET Name = '" + name + "' WHERE Name = '" + escapeSQLString(player.Name) + "'");
 MessagePlayer("[#E0E0E0]İsminiz basariyla degistirildi ",player);
 }
 }
We are his people !
Who can challange us ?

[SC]Spartan

  • Newbie
  • Posts: 25
Re: Basic Login/Registeration System
« Reply #8,  »
Thanks KrooB , i dont know if it work when i go home i will test it but what language is it?

!

  • Sr. Member
  • Don't feel shy while zooming on h*r... >>zeus#5155
  • Posts: 380

Discord: zeus#5155

Xmair

  • Wiki Contributor
  • Posts: 878
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 449
Code: [Select]
if( !sucess ) tryAgain();

!

  • Sr. Member
  • Don't feel shy while zooming on h*r... >>zeus#5155
  • Posts: 380

Discord: zeus#5155

[SC]Spartan

  • Newbie
  • Posts: 25
Re: Basic Login/Registeration System
« Reply #14,  »
AN ERROR HAS OCCURED [the index 'VARCHAR' does not exist]
I tried everything but I get this error someone could help me how to fix it? I would appreciate