Level does not exists

Started by Cool, Jul 15, 2016, 10:58 AM

Previous topic - Next topic

Cool


KAKAN

#16
There is either some problem with your onPlayerJoin or in the kick. It happens all the time or just with kick?
oh no

Finch Real

As i already told you guys his kick function is bugged
My Snipet Showroom

http://pastebin.com/5KKuU5cg

Cool

Quote from: KAKAN on Jul 15, 2016, 02:25 PMThere is either some problem with your onPlayerJoin or in the kick. It happens all the time or just with kick?
@KAKAN only happens when i kick a player with cmd not happening when someone got ban kick

KAKAN

Quote from: Hercules on Jul 15, 2016, 02:32 PM
Quote from: KAKAN on Jul 15, 2016, 02:25 PMThere is either some problem with your onPlayerJoin or in the kick. It happens all the time or just with kick?
@KAKAN only happens when i kick a player with cmd not happening when someone got ban kick
can you show me your kick function?

Quote from: Finch Real on Jul 15, 2016, 02:30 PMAs i already told you guys his kick function is bugged
I never saw a bugged kick function, but saw many bugs in onPlayerPart, so thought like that :p
oh no

Cool

function Kick( player, admin, reason )
{
    Message( "Admin " + admin.Name + " Kicked " + player.Name + " for Reason: " + reason );
    KickPlayer( player );
         SaveStats( player );

}

KAKAN

function Kick( player, admin, reason )
{
    Message( "Admin " + admin.Name + " Kicked " + player.Name + " for Reason: " + reason );
         SaveStats( player );
    player.Kick();
}
try that
oh no

Finch Real

Now it will come to Show Savestats
My Snipet Showroom

http://pastebin.com/5KKuU5cg

Cool

not working
  function SaveStats( player )
{
       try{
   local id = player.ID;
       QuerySQL( sqliteDB, "UPDATE Accounts SET Kills='" + pstats[ id ].Kills + "', Deaths='" + pstats[ player.ID ].Deaths + "', Cash='" + pstats[ id ].Cash + "', Bank='" + pstats[ id ].Bank + "' WHERE Name = '" + player.Name + "' COLLATE NOCASE" );
   print( "Saved Stats of Player " + player.Name + "[" + player.ID + "]" );
   pstats[ id ] = null;
   }
   catch(e) print( "Save Stats Error: " + e );
}

KAKAN

remove this line and try:-( from SaveStats function )
pstats[ id ] = null;
It should work now. And too, remove the foreach loop from the onPlayerPart function.
oh no

Mötley

Okay, obviously there was no proof of scripts, Or an entire cut out of everything related.

So I am only posting my input hear, Even though yesterday Hercules failed to respond to KAKAN..



Seems like you have a leaky script in general.

I would not focus anytime on any additional scripting to your server until you take the time to ensure your accounting is tight, I have a strong feeling I could find a leak in your server and become administrator.



Quote from: Hercules on Jul 15, 2016, 11:30 AM
Quote from: Finch Real on Jul 15, 2016, 11:27 AMPost Isadmin function
No need i already tested the cmd without isadmin function same error

Either way looking at your validations it is not pretty at all. You should add just a few more spaces in the code as well return more validations true.

This code was never tested and is not considered as a fix as I'm to busy to test it, So I will just use it as an example.
function onPremisionCommand(player) {
  MessagePlayer( "Invalid command! Type /cmds", player);
}

function onPlayerCommand(player, cmd, text) {

  if (cmd == "kick") {
   
    if ( IsAdmin( player, cmd ) ) {
     
      onPremisionCommand(player);
     
      return true;
   
    }
   
    if (!text) {
       
       MessagePlayer("[Syntax] /" + cmd + " <Nick/ID> <Reason>", player );

       return true;
   
    }
   
    local plr = FindPlayer(text.tointeger()), reason = GetTok( text, " ", 2, NumTok( text, " " ) );
   
    if (!plr) {
       
       MessagePlayer("[Error] - Invalid Nick/ID Specified !!", player );
       
       return true;   
   
    }
         
    Kick( plr, player, reason );

    return true;
  }
 
  onPremisionCommand(player);
 
  return false;
}



Also
You need to take the time to ensure either your classes or arrays are labeled correctly as follows in your scripts. Also ensure if you have more than one file you have correctly used dofile.


I hope something helped :)

Cool

@Motley I don't have leaked script

KAKAN

#27
Quote from: KAKAN on Jul 15, 2016, 04:47 PMremove this line and try:-( from SaveStats function )
pstats[ id ] = null;
It should work now. And too, remove the foreach loop from the onPlayerPart function.
Did you try that, @Hercules?
I'll make a kick command for you, just wait and watch.
:edit: As promised, here's the command:- function onPlayerCommand( player, cmd, text )
{
if( cmd == "kick" )
{
//Using this for quick access to that function.
local m = MessagePlayer;
if( !IsAdmin( player ) ) m("nein access",player);
else if( !text ) m("Invalid Syntax.",player);
else
{
local params = split(text," ");
if( params.len() >= 1 ) return m("You forgot the reason.",player);
local
a = params[0], //again for easy access.
plr = ( IsNum( a ) ? FindPlayer( a.tointeger() ) : FindPlayer( a ) ), //The player who is going to get kicked.
reason = ""; //reason, everyone knows it
if( !plr ) return m("Invalid player.",player);
for( local i = 1; i < params.len(); i++ ) reason += params[i];
plr.Kick();
Message( plr + " has been kicked by: " + player + ". Reason: " + reason );
}
}
}
oh no

Cool

Quote from: KAKAN on Jul 16, 2016, 07:01 AM
Quote from: KAKAN on Jul 15, 2016, 04:47 PMremove this line and try:-( from SaveStats function )
pstats[ id ] = null;
It should work now. And too, remove the foreach loop from the onPlayerPart function.
Did you try that, @Hercules?
I'll make a kick command for you, just wait and watch.
:edit: As promised, here's the command:- function onPlayerCommand( player, cmd, text )
{
if( cmd == "kick" )
{
//Using this for quick access to that function.
local m = MessagePlayer;
if( !IsAdmin( player ) ) m("nein access",player);
else if( !text ) m("Invalid Syntax.",player);
else
{
local params = split(text," ");
if( params.len() >= 1 ) return m("You forgot the reason.",player);
local
a = params[0], //again for easy access.
plr = ( IsNum( a ) ? FindPlayer( a.tointeger() ) : FindPlayer( a ) ), //The player who is going to get kicked.
reason = ""; //reason, everyone knows it
if( !plr ) return m("Invalid player.",player);
for( local i = 1; i < params.len(); i++ ) reason += params[i];
plr.Kick();
Message( plr + " has been kicked by: " + player + ". Reason: " + reason );
}
}
}
yes my kick is now also works but @KAKAN in your cmd have a problem i also put reason but error you forget reason :P please fix it i want to use your one

Mötley

Wow! I Do not understand everyone, Why do we have people intending for others to use SHITY coding.

Yet! When someone leads them in a direction that is more practical, Yet a better flow when running a server for long periods of time, Let alone Players like to find bugs.


KAKAN's code

function onPlayerCommand( player, cmd, text )
{
 if( cmd == "kick" )
 {
 //Using this for quick access to that function.
 local m = MessagePlayer;
 if( !IsAdmin( player ) ) m("nein access",player);
 else if( !text ) m("Invalid Syntax.",player);
 else
 {
 local params = split(text," ");
 if( params.len() >= 1 ) return m("You forgot the reason.",player);
 local
 a = params[0], //again for easy access.
 plr = ( IsNum( a ) ? FindPlayer( a.tointeger() ) : FindPlayer( a ) ), //The player who is going to get kicked.
 reason = ""; //reason, everyone knows it
 if( !plr ) return m("Invalid player.",player);
 for( local i = 1; i < params.len(); i++ ) reason += params[i];
 plr.Kick();
 Message( plr + " has been kicked by: " + player + ". Reason: " + reason );
 }
 }
}

This is your server, Do you really prefer to see all of your scripts looking like this?
Obviously you do.

I would really hate to read your scripts as I would not want eye cancer,.

You really should consider beefing up your scripting and stay away from the same style as FBS methods sir.

This is your server, You should want Your server to be easy to work with, Easy to read, Easy to update < Obviously it's not as you are typically having issues were as you keep posting codes, Sometimes constantly.



Motley's code
function onPremisionCommand(player) {
  MessagePlayer( "Invalid command! Type /cmds", player);
}

function onPlayerCommand(player, cmd, text) {

  if (cmd == "kick") {
   
    if ( IsAdmin( player, cmd ) ) {
     
      onPremisionCommand(player);
     
      return true;
   
    }
   
    if (!text) {
       
       MessagePlayer("[Syntax] /" + cmd + " <Nick/ID> <Reason>", player );

       return true;
   
    }
   
    local plr = FindPlayer(text.tointeger()), reason = GetTok( text, " ", 2, NumTok( text, " " ) );
   
    if (!plr) {
       
       MessagePlayer("[Error] - Invalid Nick/ID Specified !!", player );
       
       return true;   
   
    }
         
    Kick( plr, player, reason );

    return true;
  }
 
  onPremisionCommand(player);
 
  return false;
}

Please tell me as of why another scriptwriter would want to continue to lead someone in that direction, Where as it's a horrible direction.
We should be LEADING others to better methods, Better Fixes,.

Please tell me why are we doing this.


This is just as bad as having a new employee learning everything wrong, but he can function, He tries hard, But never really completes the job to his fullest possible credentials, Resulting in failure.

Then you have another employee learning better methods, Then taking on his own methods off of were he has trained. Becoming an amazing successor.

I Would Love to see others succeed in what ever they are doing in life, Not doing everything to continue to get by.