reg function error

Started by kokia, Aug 12, 2015, 06:38 AM

Previous topic - Next topic

kokia

function Register( player, password )
{
     try{
local pass = e(password);
QuerySQL( db, "INSERT INTO Account ( Name, IP, Level, Pass, Kills, Deaths, Cash, Bank, Joins, nogoto, DateRegistered, WonLMS, RandSpawn ) VALUES ( '" + player.Name.tolower() + "', '" + player.IP + "', 1, '" + pass + "', 0, 0, 0, 0, 0, 'off', '" + GetFullTime() + "', 0, 'on' )" );
QuerySQL( db, "REPLACE INTO Bstats ( Name, User, Body, Torso, LeftArm, RightArm, LeftLeg, RightLeg, Head ) VALUES ( '" + player.Name.tolower() + "', '" + player.Name + "', 0, 0, 0, 0, 0, 0, 0 )" );
     QuerySQL( db, "REPLACE INTO Wstats ( Name, User, Fist, BrassKnuckle, ScrewDriver, GolfClub, NightStick, Knife, BaseballBat, Hammer, Cleaver, Machete, Katana, Chainsaw, Grenade, RemoteGrenade, TearGas, Molotov, Missile, Colt45, Python, Shotgun, Spaz , Stubby, Tec9, Uzi, Ingrams, MP5, M4, Ruger, SniperRifle, LaserScope, RocketLauncher, FlameThrower, M60 ) VALUES ( '" + player.Name.tolower() + "', '" + player.Name + "', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )" );
         player.Cash+=2000
status[ player.ID ].IsLogged = true;
status[ player.ID ].IsReg = true;
MessagePlayer( "You've Registered!", player );
MessagePlayer( "Nick:[ " + player.Name + " ] Password:[ " + password + " ]", player );
Message( ">> " + player.Name + " is a Registered Nick-Name Now!" );
}
catch(e) print( "Reg Function Error: " + e );

}
and when i type /register <mypassword> it says you are not registered in.. and this error comes [SCRIPT]  Reg Function Error: attempt to call 'instance'it shows no lines

.

wtf is e(password) ? is that e supposed to stand for encrypt? then what does catch(e) stand for? do you see any conflict there? didn't anyone told you that you shouldn't name a global index with just one character? that's the first thing you learn as a programmer. learn to name your sh!t properly.
.

Mashreq

@S.L.C: He is using STORM256 encryption so that e stands for the encryption in this case. :)

@kokia: STORM256 encryption is unsupported have a look here. Instead of storm256 encryption you can use SHA256 for storing your password as encrypted. Please post your register command as well.

kokia

if ( cmd == "register" )
  {
   if ( status[ player.ID ].IsReg == true ) MessagePlayer( "[Error] - You're Already Registered!", player );
   else if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <Password>", player );
   else
   {
        Register( player, text );
}
  }

    else if ( cmd == "login" )
  {
     if ( status[ player.ID ].IsLogged == true ) ePrivMessage( "[Error] - You're Already Logged-In.", player );
else if ( status[ player.ID ].IsReg == false ) MessagePlayer( "You're Not Registered. Register by /register <password>", player );
else if ( !text ) MessagePlayer( "[Syntax] -  / " + cmd + " <Password>", player );
else if ( e(text) != GetPass( player ) ) MessagePlayer( "[Error] - Invalid Password.", player );
else Login( player, text );
  }
and tell me that how can i use sha256 encryption????

Mashreq

Inorder to use sha256 you need to first have the hashing plugin and load them in you server.cfg file. After loading the plugin you can use sha256 encryption for example -
local password = "kokia"; print( SHA256( password ) )
SHA256 will print a 64 length code. In your command instead of e you can use SHA256.

kokia

thank you mashreq it solved my problem lmao and now this is the problem (this problem is coming from the start not from when i fixed /register)
192.168.1.1 every user's ip in database is 192.168.1.1! help i use " + player.IP + "

Mashreq

Are you hosting your server in VPS or in your PC (localhost)?
Is the IP of the every player 192.168.1.1? Try to get the players ip using a command and see if the ip is same as 192.168.1.1.

kokia

every player ip is 192.168.1.1 i tried using a command even using /exec print("**"+FindPlayer(1).IP+".")
i am currently hosting on pc many players joined it i already posted for my vps problem that i cant access into it

Mashreq

Since your VPS problem is fixed, try to check what IP you get for the players in the server on your VPS. (other than you)

kokia

on vps it shows the right ip but on pc it shows 192.168.1.1

Thijn

Quote from: kokia on Aug 13, 2015, 07:12 AMon vps it shows the right ip but on pc it shows 192.168.1.1
That's normal, you connect locally hence the local IP.

DeViL_JiN


Thijn

Quote from: DeViL_JiN on Aug 13, 2015, 09:02 PMBump SLC I miss you :(
This isn't your topic, what the duck are you doing?