Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: kokia on Aug 12, 2015, 06:38 AM

Title: reg function error
Post by: kokia on Aug 12, 2015, 06:38 AM
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
Title: Re: reg function error
Post by: . on Aug 12, 2015, 08:40 AM
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.
Title: Re: reg function error
Post by: Mashreq on Aug 12, 2015, 09:25 AM
@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 (http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=472.msg1787#msg1787). Instead of storm256 encryption you can use SHA256 for storing your password as encrypted. Please post your register command as well.
Title: Re: reg function error
Post by: kokia on Aug 12, 2015, 11:22 AM
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????
Title: Re: reg function error
Post by: Mashreq on Aug 12, 2015, 01:34 PM
Inorder to use sha256 you need to first have the hashing plugin  (https://bitbucket.org/stormeus/0.4-hashing-algorithms/downloads) 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.
Title: Re: reg function error
Post by: kokia on Aug 12, 2015, 02:29 PM
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 + "
Title: Re: reg function error
Post by: Mashreq on Aug 12, 2015, 02:33 PM
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.
Title: Re: reg function error
Post by: kokia on Aug 12, 2015, 02:49 PM
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
Title: Re: reg function error
Post by: Mashreq on Aug 13, 2015, 06:19 AM
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)
Title: Re: reg function error
Post by: kokia on Aug 13, 2015, 07:12 AM
on vps it shows the right ip but on pc it shows 192.168.1.1
Title: Re: reg function error
Post by: Thijn on Aug 13, 2015, 04:34 PM
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.
Title: Re: reg function error
Post by: DeViL_JiN on Aug 13, 2015, 09:02 PM
Bump SLC I miss you :(
Title: Re: reg function error
Post by: Thijn on Aug 14, 2015, 05:52 AM
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?