Vice City: Multiplayer

VC:MP Discussion => General Discussion => Topic started by: SAzEe21 on May 16, 2015, 10:47 AM

Title: Need help..
Post by: SAzEe21 on May 16, 2015, 10:47 AM
Hello there.
                  What's that, need help....

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F4yjsliL.png&hash=cda0abbb100593fadff12c915056bc6950b19d30)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FlzeETOs.png&hash=da5ac1535d4043b7e96fdfd9b2064675ea801604)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FBwLWXY4.png&hash=ad64676828bfb17e9fd6200ece7ca5411d00795c)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FtSXGwZ4.png&hash=cb1a228bc24c71eeee71767dc1681c656a1dbfe5)
Title: Re: Need help..
Post by: ysc3839 on May 16, 2015, 10:51 AM
Quote from: Zeeshan.Bhatti on May 16, 2015, 10:47 AMHello there.
                  What's that, need help....

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F4yjsliL.png&hash=cda0abbb100593fadff12c915056bc6950b19d30)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FlzeETOs.png&hash=da5ac1535d4043b7e96fdfd9b2064675ea801604)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FBwLWXY4.png&hash=ad64676828bfb17e9fd6200ece7ca5411d00795c)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FtSXGwZ4.png&hash=cb1a228bc24c71eeee71767dc1681c656a1dbfe5)
See server screenshot.
Title: Re: Need help..
Post by: SAzEe21 on May 16, 2015, 11:31 AM
Can you tell me what's the problem. Why, server got crashed when player joins.
Title: Re: Need help..
Post by: SAzEe21 on May 16, 2015, 12:08 PM
function onPlayerJoin( player )
{
local IP = player.IP;
  print("** " + player + " has join the game at " + GetFullTime() + ".");
    Message( player.Name + "'s Connecting From: " + IpToCountry( IP ) );
rPrivMessage("Welcome " + player.Name + ", IP: " + player.IP + ".",player);
  rPrivMessage("To server " + NameServer + ".",player);
LastActive(player);
    NewTimer( "AccInfo", 500, 1, player );
}

Title: Re: Need help..
Post by: jayant on May 16, 2015, 12:12 PM
Timer is crashing maybe as many times people here in forum said this..Pass playerID as Doom said to avoid crash.
Title: Re: Need help..
Post by: DizzasTeR on May 16, 2015, 12:26 PM
Instances in timers crash the server, send a ID and then take it's instance like so...

function onPlayerJoin( player )
{
  local IP = player.IP;
  print("** " + player + " has join the game at " + GetFullTime() + ".");
    Message( player.Name + "'s Connecting From: " + IpToCountry( IP ) );
  rPrivMessage("Welcome " + player.Name + ", IP: " + player.IP + ".",player);
  rPrivMessage("To server " + NameServer + ".",player);
  LastActive(player);
    NewTimer( "AccInfo", 500, 1, player.ID );
}

function AccInfo( p )
{
local player = FindPlayer( p );
if( player )
{
# Place all your accinfo function here now
}
}

Won't crash now.
Title: Re: Need help..
Post by: SAzEe21 on May 16, 2015, 04:09 PM
Doom_Killer and Finch, I tried yours functions, it says.

 AccInfo Error : "the index "CheckBan" does not exist".

And, I joined the server, it says : [WARNING]GetFullTime is deprecated and may be removed in the future.
                                                [WARNING]Please use Squirrel's date() function instead.

And, all commands also not working in the server.

Help please.
Title: Re: Need help..
Post by: DizzasTeR on May 16, 2015, 04:16 PM
Post your accinfo duh
Title: Re: Need help..
Post by: SAzEe21 on May 16, 2015, 04:21 PM
function AccInfo( player );
{
      try{

  if ( CheckBan( player ) == 1 ) Kick( player, "Server", "Banned From Server" );
  status[ player.ID ] = PlayerStats();
  local id = player.ID;
  local ip = player.IP;
  if ( GetLevel( player ) >= 1 )
  {
      if ( ip != GetIP( player ) )
  {
              ePrivMessage("Please, insert your password to logged.",player);
              ePrivMessage("To login type: /c login <password>.",player);
  status[ player.ID ].IsReg = true;
  status[ player.ID ].IsLogged = false;
  }
  else if ( ip == GetIP( player ) )
  {
       local q = QuerySQL( db, "SELECT * FROM Account WHERE Name='" + player.Name.tolower() + "'" );
   if ( GetSQLColumnData( q, 0 ) != null )
              {
   status[ player.ID ].Kills = GetSQLColumnData( q, 4 );
   status[ player.ID ].Deaths = GetSQLColumnData( q, 5 );
   status[ player.ID ].Cash = GetSQLColumnData( q, 6 );
   status[ player.ID ].Bank = GetSQLColumnData( q, 7 );
   status[ player.ID ].Joins = GetSQLColumnData( q, 8 );
   }
   GetSQLNextRow( q );
   ePrivMessage("Has been auto-logged on the server!",player);
           ePrivMessage("Name:[" + player.Name + "], Level:[" + GetLevel(player) + "], State:[" + GetLevelTag(player) + "].",player);
   status[ player.ID ].IsReg = true;
   status[ player.ID ].IsLogged = true;
   status[ player.ID ].Joins++;
   
  }
 
  }
  else
  {
    ePrivMessage("Please register your nick for access to services.",player);
    ePrivMessage("To register type: /c register <password>.",player);  
  }
  WriteIniString( "Files/ServData.ini", "IP", player.Name, player.IP );
  }
  catch(e) print( "AccInfo Error: " + e );
}
Title: Re: Need help..
Post by: MacTavish on May 16, 2015, 04:26 PM
Also post CheckBan function the problem seems not to be here. And Finch stop it Brainless kid

And Zeeshan ill suggest you to create script from scratch instead of porting and old one, after solving this the other errors will continuelsy appears
Title: Re: Need help..
Post by: SAzEe21 on May 16, 2015, 04:30 PM
Quote from: FinchDon on May 16, 2015, 04:24 PMhey bro use it

function AccInfo( player )
{
      try{

  if ( CheckBan( player ) == 1 ) Kick( player, "Server", "Banned From Server" );
  status[ player.ID ] = PlayerStats();
  local id = player.ID;
  local ip = player.IP;
  if ( GetLevel( player ) >= 1 )
  {
      if ( ip != GetIP( player ) )
  {
              ePrivMessage("Please, insert your password to logged.",player);
              ePrivMessage("To login type: / login <password>.",player);
  status[ player.ID ].IsReg = true;
  status[ player.ID ].IsLogged = false;
  }
  else if ( ip == GetIP( player ) )
  {
       local q = QuerySQL( db, "SELECT * FROM Account WHERE Name='" + player.Name.tolower() + "'" );
   if ( GetSQLColumnData( q, 0 ) != null )
              {
   status[ player.ID ].Kills = GetSQLColumnData( q, 4 );
   status[ player.ID ].Deaths = GetSQLColumnData( q, 5 );
   status[ player.ID ].Cash = GetSQLColumnData( q, 6 );
   status[ player.ID ].Bank = GetSQLColumnData( q, 7 );
   status[ player.ID ].Joins = GetSQLColumnData( q, 8 );
   }
   GetSQLNextRow( q );
   ePrivMessage("Has been auto-logged on the server!",player);
           ePrivMessage("Name:[" + player.Name + "], Level:[" + GetLevel(player) + "], State:[" + GetLevelTag(player) + "].",player);
   status[ player.ID ].IsReg = true;
   status[ player.ID ].IsLogged = true;
   status[ player.ID ].Joins++;
   
  }
 
  }
  else
  {
    ePrivMessage("Please register your nick for access to services.",player);
    ePrivMessage("To register type: / register <password>.",player);  
  }
  WriteIniString( "Files/ServData.ini", "IP", player.Name, player.IP );
  }
  catch(e) print( "AccInfo Error: " + e );
}


Your function works thanks bro. But, all commands not working fine.
Title: Re: Need help..
Post by: MacTavish on May 16, 2015, 04:38 PM
There was no fault in the function, see the difference in both function,

@zeeshan, by mistake you have this

function AccInfo(player); insteat AccInfo(player)


You put an ; in last
Title: Re: Need help..
Post by: DizzasTeR on May 16, 2015, 04:57 PM
Still tho, I know why the commands are no working, He didn't do what I suggested him... Here you go.

function onPlayerJoin( player )
{
local IP = player.IP;
print("** " + player + " has join the game at " + GetFullTime() + ".");
    Message( player.Name + "'s Connecting From: " + IpToCountry( IP ) );
rPrivMessage("Welcome " + player.Name + ", IP: " + player.IP + ".",player);
rPrivMessage("To server " + NameServer + ".",player);
LastActive(player);
    NewTimer( "AccInfo", 500, 1, player.ID );
}

function AccInfo( p );
{
      try
  {
local player = FindPlayer( p );
if ( CheckBan( player ) == 1 ) Kick( player, "Server", "Banned From Server" );
status[ player.ID ] = PlayerStats();
local id = player.ID;
local ip = player.IP;
if ( GetLevel( player ) >= 1 )
{
if ( ip != GetIP( player ) )
{
ePrivMessage("Please, insert your password to logged.",player);
ePrivMessage("To login type: /c login <password>.",player);
status[ player.ID ].IsReg = true;
status[ player.ID ].IsLogged = false;
}

else if ( ip == GetIP( player ) )
{
local q = QuerySQL( db, "SELECT * FROM Account WHERE Name='" + player.Name.tolower() + "'" );
if ( GetSQLColumnData( q, 0 ) != null )
{
status[ player.ID ].Kills = GetSQLColumnData( q, 4 );
status[ player.ID ].Deaths = GetSQLColumnData( q, 5 );
status[ player.ID ].Cash = GetSQLColumnData( q, 6 );
status[ player.ID ].Bank = GetSQLColumnData( q, 7 );
status[ player.ID ].Joins = GetSQLColumnData( q, 8 );
}

GetSQLNextRow( q );
ePrivMessage("Has been auto-logged on the server!",player);
ePrivMessage("Name:[" + player.Name + "], Level:[" + GetLevel(player) + "], State:[" + GetLevelTag(player) + "].",player);
status[ player.ID ].IsReg = true;
status[ player.ID ].IsLogged = true;
status[ player.ID ].Joins++;
}
   }
   else
   {
ePrivMessage("Please register your nick for access to services.",player);
ePrivMessage("To register type: /c register <password>.",player);   
   }
   WriteIniString( "Files/ServData.ini", "IP", player.Name, player.IP );
   }
   catch(e) print( "AccInfo Error: " + e );
}

If it still does not work, Go with Beztone's suggestion.
Title: Re: Need help..
Post by: SAzEe21 on May 16, 2015, 05:16 PM
AN ERROR HAS OCCURED [the index "IsReg" does not exist
and

OnPlayerCommand Error : the index 'IsReg' does not exist
OnPlayerCommand Error : the index 'IsLogged' does not exist.

AN ERROR HAS OCCURED : the index 'Kills' does not exits

:(
Title: Re: Need help..
Post by: Kratos_ on May 16, 2015, 05:20 PM
You could wrap the entire body of function AccInfo for checking if the player object found through FindPlayer is appropriate or not. Although , it's not of much significance since you're calling it at player join which obviously be valid. But , optimizations won't make us pay. :P
Title: Re: Need help..
Post by: SAzEe21 on May 17, 2015, 07:53 AM
Your functions is working fine. But, server commands not working.
Title: Re: Need help..
Post by: . on May 17, 2015, 02:14 PM
Quote from: Zeeshan.Bhatti on May 16, 2015, 05:16 PMAN ERROR HAS OCCURED [the index "IsReg" does not exist
and

OnPlayerCommand Error : the index 'IsReg' does not exist
OnPlayerCommand Error : the index 'IsLogged' does not exist.

AN ERROR HAS OCCURED : the index 'Kills' does not exits

:(

Yep, I'm forced to leave the computer again. These index errors (http://forum.vc-mp.org/?topic=667.msg4281#msg4281) are killing me. I'll be back in a couple minutes.
Title: Re: Need help..
Post by: SAzEe21 on May 17, 2015, 03:02 PM
lol  :(
Title: Re: Need help..
Post by: GangstaRas on May 17, 2015, 03:18 PM
I'm very new to this life so forgive my simplistic answer if it's not what you're looking for but I noticed that you got a warning that you must define the port in server.cfg. That made me wonder if you have an internet issue with the program because I know for a fact that server.exe always crashes if your PC is not on the internet/should its internet capabilities be blocked somehow. It's a delayed crash as well; perhaps its coincidence the time you take to join it crashes then
Title: Re: Need help..
Post by: Thijn on May 17, 2015, 03:23 PM
The warning means he used his 0.3 config without removing the listenport from there. He probably still has it in the server.cfg though.
Title: Re: Need help..
Post by: SAzEe21 on May 18, 2015, 02:40 AM
Anyway, Thank's guys for the help.

Topic lock please