Update Reason: Used vcmp official hashing, unique id concept has been used and installation is made simple.
Commands:
-> /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()
/* onScriptLoad() */
dofile( "rlc.nut", true );
rlc_table.onScriptLoad( );
onPlayerJoin( player )
/* onPlayerJoin( player ) */
rlc_table.onPlayerJoin( player );
onPlayerPart( player, reason )
/* onPlayerPart( player, reason ) */
rlc_table.onPlayerPart( player );
onPlayerCommand( player, command, arguments )
/* 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 (https://github.com/zeus-gaming/RLC)
okay but the database not saveing why ?
@zeus
@zeusi am adding clan system too!
i think the problem here
//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 );
}
(https://i.imgur.com/NVMlmYp.jpg)
It means something. (http://forum.vc-mp.org/?topic=4025.msg29787#msg29787)
(Sorry For Bumping Old Topics) Thank You So Much! This Helped Alot!
Could you please add a system that changes the player's nickname and writes it to the database?
Try this
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);
}
}
Thanks KrooB , i dont know if it work when i go home i will test it but what language is it?
Quote from: [SC]Spartan on Aug 28, 2018, 02:40 PMThanks KrooB , i dont know if it work when i go home i will test it but what language is it?
Turkish
Why do you use a custom encryption method?
Quote from: Xmair on Aug 29, 2018, 06:17 AMWhy do you use a custom encryption method?
Maybe he don't know how to use Hashing plugin
Quote from: Takanaue on Aug 29, 2018, 06:32 AMQuote from: Xmair on Aug 29, 2018, 06:17 AMWhy do you use a custom encryption method?
Maybe he don't know how to use Hashing plugin
Yep he is right 11 months ago I never knew about hashing plugin maybe I can update this topic later and remove the custom encryption
made by Stormeus and use the official hashing function.
No work :|
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
Quote from: [SC]Spartan on Sep 06, 2018, 06:01 PMAN 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
local name = text.tointeger();
Quote from: Xmair on Aug 29, 2018, 06:17 AMWhy do you use a custom encryption method?
It's not a 'custom encryption', nor an 'encryption'.
It's the SHA-256
hashing (one way function) algorithm but implemented in squirrel (still, should use the hashing plugin instead.)
if (cmd == "cambiarnick")
{
if ( Stats[ player.ID ].LoggedIn == true ) return MessagePlayer( "[#E0E0E0]Debes iniciar sesión en el servidor", player );
else if ( Stats[ player.ID ].Registered == true ) return MessagePlayer( "[#E0E0E0]Debes ser registrado", player );
else if ( !text ) MessagePlayer("[#E0E0E0]Código: / cambio de nombre <Nuevo nombre>",player);
else {
local name = VARCHAR(25);
QuerySQL( db, "UPDATE Accounts SET Name = '" + name + "' WHERE Name = '" + escapeSQLString(player.Name) + "'");
MessagePlayer("[#E0E0E0]Su nombre ha sido cambiado con éxito ",player);
}
}
Credit to KrOoB:
i have this error
AN ERROR HAS OCCURED [the index 'VARCHAR' does not exist]
I tried everything.
If there is no solution, could someone help me to do another one to change the nickname if the name is not removed
[RLC] Register, Login & Change Password
Update Reason: Used vcmp official hashing, unique id concept has been used and installation is made simple.
Topic Updated: Link (https://forum.vc-mp.org/?topic=5144.msg37031#msg37031)
:edit:
Quote from: [SC]Spartan on Sep 07, 2018, 07:05 AMAN ERROR HAS OCCURED [the index 'VARCHAR' does not exist]
I tried everything.
If there is no solution, could someone help me to do another one to change the nickname if the name is not removed
This snippet is not related to this topic if you have any issue in installation or found bug in this topic post here otherwise get dafaq out of this topic and create a support ticket over there Link (https://forum.vc-mp.org/?board=10.0)