Need help..

Started by SAzEe21, May 16, 2015, 10:47 AM

Previous topic - Next topic

SAzEe21

Hello there.
                  What's that, need help....





ysc3839

Quote from: Zeeshan.Bhatti on May 16, 2015, 10:47 AMHello there.
                  What's that, need help....





See server screenshot.

SAzEe21

Can you tell me what's the problem. Why, server got crashed when player joins.

SAzEe21

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


jayant

#4
Timer is crashing maybe as many times people here in forum said this..Pass playerID as Doom said to avoid crash.

DizzasTeR

#5
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.

SAzEe21

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.

DizzasTeR

Post your accinfo duh

SAzEe21

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

MacTavish

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

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

SAzEe21

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.

MacTavish

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

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

DizzasTeR

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.

SAzEe21

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

:(

Kratos_

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
In the middle of chaos , lies opportunity.