how to make a autologin system by uid how i can do that i have already uidalias sytem available but how to make autologin
wait some secs, ill release a script with uid autologin, but you will have to edit it.
function onPlayerCommand(player,cmd,text)
{
if (cmd=="autologin")
{
if(!text) {
MessagePlayer("you must write /autologin on/off",player)
return false;
}
if (text=="on")
{
WriteIniBool("Stats.ini","Autologin",player.UID2,true)
MessagePlayer("Autologin has been enabled",player)
return true;
}
else if(text=="off")
{
WriteIniBool("Stats.ini","Autologin",player.UID2,false)
MessagePlayer("Autologin has been disabled",player)
return true;
}
}
}
function onPlayerSpawn(player)
{
if (ReadIniBool("Stats.ini", "Autologin",player.UID2))
{
MessagePlayer("You have been automatically logged in",player)
//LoadAccount(player) YOUR LOADING ACCOUNT FUNCTION!
}
else {
MessagePlayer("Login to your account using /login",player)
}
}
not tested, but you need add your functions yourself. idk wut u use, my acc system or what.
idk if works, cant test, my vcmp doesnt work
i am not using ini or i will never use it but thanks its gives me idea how to do it i will try to make it
Whoa this is very dangerous... someone who enabled autologin can now autologin in ANY account!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
i said, i havent tested it because my vc doesnt work correctly, i only putted a example how it would look like, i didnt have time 2 test
and i dont think if this is dangerous, if you login on some admins nick, you wont get admin, reads your admin from uid, ( in my acc system, yep, the protection exists)
@EK.CrystalBlue can you give me example i am using db
uid+uid2+subnet is safe I think.
Or do what any other sane person would do. Use passwords.
Quote from: Thijn on Aug 04, 2016, 04:47 PMOr do what any other sane person would do. Use passwords.
sadly no cookies in vcmp...
Quote from: Hercules on Aug 04, 2016, 04:08 PM@EK.CrystalBlue can you give me example i am using db
register as Hax0r and enable autologin
then join as Hercules
it will autolog you in; instant admin
If i were to use an autologin system I would save the players last uid and ip. Also store autologin in the players data from the command. Then store the players ip uid in a array. If the uid and ip = the players ip and or uid then log them in.
Make sure to store the players password in an array so you can do something on the login function login(player, thatarraypassword, statDB);something like that.
Sorry I'm at work.
Quote from: Mötley on Aug 04, 2016, 07:47 PMIf i were to use an autologin system I would save the players last uid and ip. Also store autologin in the players data from the command. Then store the players ip uid in a array. If the uid and ip = the players ip and or uid then log them in.
Make sure to store the players password in an array so you can do something on the login function login(player, thatarraypassword, statDB);something like that.
Sorry I'm at work.
Motely i am also thinking like that how you explain in fuzzie account system ip available but not uid
Hello Friend I had done an automatic registration system and connect to the account automatically hope and serve as the example
//---------------------------------------------------
//---------------------------------------------------
function onScriptLoad()
{
Registers <- ConnectSQL( "RegistersPlayerUnique.db" );
QuerySQL(Registers,"CREATE TABLE IF NOT EXISTS Account(PlayerName TEXT, PlayerUnique TEXT )" );
}
//---------------------------------------------------
function LoadAccount( p )
{
local q = QuerySQL( Registers, "SELECT * FROM Account WHERE PlayerUnique='" + p.UniqueID + "'" ),UniqueID;
UniqueID = GetSQLColumnData( q, 1 );
if ( UniqueID ) return true;
else return false;
}
//---------------------------------------------------
function onPlayerJoin( player )
{
if ( LoadAccount( player ) == true )
{
MessagePlayer(""+player.Name+": your data is loaded automatically...",player);
local Account= QuerySQL(Registers, "SELECT * FROM Account WHERE PlayerUnique= '" + player.UniqueID + "'" );
if(Account)
{
//Add here what load player
}
}
if ( LoadAccount( player ) == false )
{
MessagePlayer(""+player.Name+" : Your data is saved automatically...",player);
QuerySQL( Registers, "INSERT INTO Account (PlayerName,PlayerUnique) VALUES ( '"+player.Name+"', '"+player.UniqueID+"' )" );
//Adds here what you give to the play to the register is automatically
}
}
//---------------------------------------------------
//---------------------------------------------------
@Hercules, download FAS account system. Remove the player.IP and put player.UID.
Repeat it in all the places. Don't do anything else, you're done :)
Quote from: KAKAN on Aug 05, 2016, 08:40 AM@Hercules, download FAS account system. Remove the player.IP and put player.UID.
Repeat it in all the places. Don't do anything else, you're done :)
i already using FAS and thanks for idea i was waiting for your reply from much time :D
[EDIT]
@KAKAN its works but for only new accounts not replacing the ips with uid onplayerlogin
Quote from: Hercules on Aug 05, 2016, 09:12 AMQuote from: KAKAN on Aug 05, 2016, 08:40 AM@Hercules, download FAS account system. Remove the player.IP and put player.UID.
Repeat it in all the places. Don't do anything else, you're done :)
i already using FAS and thanks for idea i was waiting for your reply from much time :D
[EDIT] @KAKAN its works but for only new accounts not replacing the ips with uid onplayerlogin
Yes, it won't work with old accounts as it will change the the last-logged-ip to last-logged-UID
If you store the UIDs somewhere else, you can access that and change everyone's IP with UID.
Quote from: KAKAN on Aug 05, 2016, 10:49 AMQuote from: Hercules on Aug 05, 2016, 09:12 AMQuote from: KAKAN on Aug 05, 2016, 08:40 AM@Hercules, download FAS account system. Remove the player.IP and put player.UID.
Repeat it in all the places. Don't do anything else, you're done :)
i already using FAS and thanks for idea i was waiting for your reply from much time :D
[EDIT] @KAKAN its works but for only new accounts not replacing the ips with uid onplayerlogin
Yes, it won't work with old accounts as it will change the the last-logged-ip to last-logged-UID
If you store the UIDs somewhere else, you can access that and change everyone's IP with UID.
i have stored in uidalias table but how i can change :P
Quote from: Hercules on Aug 05, 2016, 10:59 AMQuote from: KAKAN on Aug 05, 2016, 10:49 AMQuote from: Hercules on Aug 05, 2016, 09:12 AMQuote from: KAKAN on Aug 05, 2016, 08:40 AM@Hercules, download FAS account system. Remove the player.IP and put player.UID.
Repeat it in all the places. Don't do anything else, you're done :)
i already using FAS and thanks for idea i was waiting for your reply from much time :D
[EDIT] @KAKAN its works but for only new accounts not replacing the ips with uid onplayerlogin
Yes, it won't work with old accounts as it will change the the last-logged-ip to last-logged-UID
If you store the UIDs somewhere else, you can access that and change everyone's IP with UID.
i have stored in uidalias table but how i can change :P
Take this as a sample:-
local data = QuerySQL(database,"SELECT Name, UID FROM UIDAlias");
while( GetSQLColumnData( data, 0 ) != null )
{
QuerySQL(database,format("UPDATE Accounts SET LastIP='%s' WHERE Name='%s'",
GetSQLColumnData( data, 1 ),
GetSQLColumnData( data, 0 )
));
GetSQLNextRow( data );
}
Untested, but should give an idea
Okay I got home from work at 1 am in the morning, Then i need to be at work today in 3 more hours.
I managed to put together a autologin for myself in 5 minutes last night,
The only server I was able to last night was a LU server
[So my method would need to be converted to VCMP]
My server uses arrays but you should get an Idea, I plan to do something with the UID I just do not know yet.
Maybe you could do something with this,
Sorry code moved and I just literally woke up
Code select does not like it when you always press TAB
Auto_Login <- array(GetMaxPlayers(), null);
function onPlayerJoin( player ) {
local q = sqlite_query( statDB, "SELECT Password, Players_IP, Player_UID, Auto_Login, Level, Kills, Deaths, Money, Bank, Skin, Wanted_Level, Health, Armour FROM Stats WHERE Name='" + player.Name + "'" );
Auto_Login[ player.ID ] = 0;
// If the player had previous stats saved (ie. there's value in the first column of the first row)
if ( sqlite_column_data( q, 0 ) != null ) {
// Fetch the asked values from the columns of the returned row
//We only want to set certain values to validate a player
Player_Password[ player.ID ] = sqlite_column_data( q, 0 );
Player_IP[ player.ID ] = sqlite_column_data( q, 1 );
Player_UID[ player.ID ] = sqlite_column_data( q, 2 );
Auto_Login[ player.ID ] = sqlite_column_data( q, 3 );
if (Auto_Login[player.ID] == 1) {
if (Player_IP[player.ID] != "" && player.IP == Player_IP[player.ID]) {
onPlayerLogin(player, Player_Password[ player.ID ], statDB);
return true;
}
}
}
// Finalize query result
sqlite_free( q );
return 1;
}
function onPlayerCommand( player, cmd, text ) {
if (cmd == "autologin") {
if (Logged[player.ID] == false) {
MessagePlayer( "You are not logged in", player);
return true;
}
Auto_Login[player.ID] = 1 - Auto_Login[player.ID];
if (Auto_Login[player.ID] == 0) {
MessagePlayer( "Auto login: OFF", player);
return true;
}
else {
MessagePlayer( "Auto login: ON", player );
return true;
}
return true;
}
}
it's extremly important to give data, In fuzzie system you are given so much data even your level I think that the system is bugged.
This is alpha and needs upgrading
function onPlayerLogin( player, password, statDB ) {
local query = sqlite_query( statDB, "SELECT Password, Players_IP, Player_UID, Auto_Login, Level, Kills, Deaths, Money, Bank, Skin, Wanted_Level, Health, Armour FROM Stats WHERE Name='" + player.Name + "'" );
//We already validated the password in the command, But for safety lets add a check "Feel free to remove"
if (::sqlite_column_data( query, 0 ) != password) {
MessagePlayer("Wrong Password", player);
return false;
}
Level[ player.ID ] = sqlite_column_data( query, 4 );
Kills[ player.ID ] = sqlite_column_data( query, 5 );
Deaths[ player.ID ] = sqlite_column_data( query, 6 );
Money[ player.ID ] = sqlite_column_data( query, 7 );
Bank[ player.ID ] = sqlite_column_data( query, 8 );
Skin[ player.ID ] = sqlite_column_data( query, 9 );
Wanted[ player.ID ] = sqlite_column_data( query, 10 );
Health[ player.ID ] = sqlite_column_data( query, 11 );
Armour[ player.ID ] = sqlite_column_data( query, 12 );
player.Cash = Money[ player.ID ];
player.Skin = Skin[ player.ID ];
player.WantedLevel = Wanted[ player.ID ];
player.Health = Health[ player.ID ];
player.Armour = Armour[ player.ID ];
SetMoney(player, Money[ player.ID ]);
MessagePlayer("[#0080ff]Congradulations! You have sucsesfully logged in", player);
Logged[ player.ID ] = true;
}
I don't even know why this topic has 2 pages by now. How hard can it be for you to change an auto login system with IPs to an UID?
Quote from: Thijn on Aug 05, 2016, 03:46 PMI don't even know why this topic has 2 pages by now. How hard can it be for you to change an auto login system with IPs to an UID?
not hard but i cant able to change old players ip to uid but now i add update query on player join thanks solved