Uid autologin

Started by Cool, Aug 04, 2016, 02:15 PM

Previous topic - Next topic

Cool

#15
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

KAKAN

Quote from: Hercules on Aug 05, 2016, 09:12 AM
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
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.
oh no

Cool

Quote from: KAKAN on Aug 05, 2016, 10:49 AM
Quote from: Hercules on Aug 05, 2016, 09:12 AM
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
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

KAKAN

Quote from: Hercules on Aug 05, 2016, 10:59 AM
Quote from: KAKAN on Aug 05, 2016, 10:49 AM
Quote from: Hercules on Aug 05, 2016, 09:12 AM
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
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
oh no

Mötley

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;
}

Thijn

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?

Cool

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