Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Cool on Jul 15, 2016, 10:58 AM

Title: Level does not exists
Post by: Cool on Jul 15, 2016, 10:58 AM
hi when i kick some one he got kicked but the console give error here is screen shot
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi66.tinypic.com%2Fqs6s7t.png&hash=3b6a4a76bf78fe6a57c3a64b11a55a6f3b8221a2)
error line 384 =    if( pstats[ player.ID ].Level != 0 )
Title: Re: Level does not exists
Post by: [RRZ]_Genius on Jul 15, 2016, 11:04 AM
you didn't have level index m8
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 11:09 AM
Quote from: [RRZ]_Genius on Jul 15, 2016, 11:04 AMyou didn't have level index m8
so sad any one else
Title: Re: Level does not exists
Post by: Finch Real on Jul 15, 2016, 11:21 AM
Post your cmd
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 11:25 AM
else if ( cmd == "kick" )
{
    if ( IsAdmin( player, cmd ) ) return 0;
else if ( !text ) MessagePlayer("[Syntax] /" + cmd + " <Nick/ID> <Reason>", player );
                else
                {
         local plr = GetPlayer( GetTok( text, " ", 1 ) );
       if ( !plr ) MessagePlayer("[Error] - Invalid Nick/ID Specified !!", player );
       else
        {
            local reason = GetTok( text, " ", 2, NumTok( text, " " ) );
            if ( reason == null ) reason = "None";
            Kick( plr, player, reason );
                    }
}
     }
Title: Re: Level does not exists
Post by: Cool 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
Title: Re: Level does not exists
Post by: Finch Real on Jul 15, 2016, 11:30 AM

We are not here to stole your facking cmd with function don't post fix it your self
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 11:36 AM
Quote from: Finch Real on Jul 15, 2016, 11:30 AMWe are not here to stole your facking cmd with function don't post fix it your self
I didnt say you help me noob i was waiting for Some good persons Reply for example KAKAN Why i will ask for help from a noob which says error comes EMessage does not exists
and you stealing passwords how i belive you will not steal my function
Quote from: Stormeus on Sep 28, 2015, 03:17 PM@FinchDon was banned for the above post for suggesting users harvest passwords on their servers and then posting what he claims is Wolf's password on the forum. His post included a Squirrel snippet to facilitate this, and stated that he used it on his own servers.

The password he posted did not match his forum password but was removed in case it was his account password for any VC:MP servers.

I would advise all players to immediately stop playing on any servers operated by or affiliated with him, and if they have played on any such servers to change their passwords.

Servers run by Finch include a VCCNR clone (http://forum.vc-mp.org/?topic=1156.msg7663#msg7663) and Battle for Middle Earth (http://forum.vc-mp.org/?topic=1405.msg9664#msg9664).
Title: Re: Level does not exists
Post by: Finch Real on Jul 15, 2016, 11:41 AM
Things get changed in future
Even you don't know In Start @KAKAN @jayant was asking index emessage does not exist
That's was misunderstanding Because of [VU]Wolf they can even banned me again but i have sented proff to stormeus in past and stupids Even don't know what is happening
Title: Re: Level does not exists
Post by: KAKAN on Jul 15, 2016, 12:55 PM
@Hercules, post your onPlayerPart, make sure that you're not setting that array to null before checking the Level.
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 12:58 PM
function onPlayerPart( player, reason ){
if( pstats[ player.ID ].Level != 0 ){
pstats[ player.ID ].Update( player, sqliteDB );
}
if (pAway.rawin(oldname[player.ID]))
{
player.Name = ""+oldname[player.ID]+"";
pAway.rawdelete( player.Name );
oldname[player.ID] = null;
}

EchoMessage( ICOL_RED + "[" + player.ID + "] " + player.Name + " left the Server. (" + reason + ")" );
print("** " + player + " has left the game. ( " + reason + " ) at " + GetFullTime() + ".");
local w = pstats[ player.ID ].Lost;
QuerySQL( sqliteDB, format( "UPDATE LMS SET Lost=%i WHERE Name='" + player.Name.tolower() + "'", w ) );
local b = pstats[ player.ID ].Played;
QuerySQL( sqliteDB, format( "UPDATE LMS SET Played=%i WHERE Name='" + player.Name.tolower() + "'", b ) );
local f = pstats[ player.ID ].Wins;
QuerySQL( sqliteDB, format( "UPDATE LMS SET Won=%i WHERE Name='" + player.Name.tolower() + "'", f ) ); 
print( ">> " + player.Name + "'s data saved." );

     if ( pstats[ player.ID ].LMS )
        {
          Message( ">> [#4682B4][Info][#FFFFFF] " + player.Name + " is out of the LMS round." );
          LMSCount--;
          if ( LMSCount == 1 ) CheckEnd2();
        }
if ( pstats[ player.ID ].Team == true )
 {
  local plr = FindPlayer( pstats[ player.ID ].Partner );
  if ( plr ) {
   PrivMessage( plr, "[#4682B4][Info][#FFFFFF] " + player.Name + " left the team." );
   pstats[ plr.ID ].Partner = null;
   pstats[ plr.ID ].Team = false;
  }
  }
  if ( pstats[ player.ID ].raceplayer ) {
 racecount--;
 Message( "[#4682B4][Info][#FFFFFF]" + player.Name + " is out of the race." );
    if ( racecount == 0 ) closerace();
 pstats[ player.ID ].raceplayer = false;
    }
if ( GetPlayers() == 0 && newsTimer.Paused == false )
{
newsTimer.Paused = true;
print("timer paused");
}
if (SpawnwepPlayer[ player.ID ] != null)
{
if(!CheckTableSpawnwep( player )) QuerySQL( sqliteDB, "REPLACE INTO Spawnwep( Nick, Weps ) VALUES ( '" + player.Name + "','"+ SpawnwepPlayer[ player.ID ] + "' ) ");
else QuerySQL( sqliteDB, "UPDATE Spawnwep SET Weps='"+ SpawnwepPlayer[ player.ID ] +"'  WHERE Nick='" + player.Name + "'" );
SpawnwepPlayer[ player.ID ] = null; print( player.Name +"'s Spawnwep Saved!" );
}
IsMuted[ player.ID ] = false;
spree[ player.ID ].End();
spree[ player.ID ] = null;
SaveStats( player );
pstats[ player.ID ] = null;
}
Title: Re: Level does not exists
Post by: Xmair on Jul 15, 2016, 01:05 PM
Do you have the pstats array? Post your player class here.
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 01:07 PM
///  Player Class
class PlayerClass
{
LastUsedIP = "0.0.0.0";
Cash = 0;
Bank = 0;
Kills = 0;
Deaths = 0;
Level = 0;
Registered = false;
Logged = false;
IdBeingEdit = null;
    IsBeingEdited =false;
chat = 0;
Muted = false;
nogoto = false;
hide_admin = false;
PHidden = false;
chat = 0;
loan =  false;
Team = false;
Request = false;
TimeRequest = 0;
Partner = null;
LMS = false;
 Wins = 0;
 Played = 0;
 Lost = 0;
 Bet = null;
  raceplayer = false;
loanammount = 0;

pstats <- array( GetMaxPlayers(), null );
Title: Re: Level does not exists
Post by: KAKAN on Jul 15, 2016, 01:35 PM
Run this on onPlayerPart and tell me the result:-
foreach( key, val in pstats[ player.ID ] ) print( key + " : " + value );
Title: Re: Level does not exists
Post by: Finch Real on Jul 15, 2016, 01:40 PM
Might some error in kick function
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 01:56 PM
@KAKAN
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi63.tinypic.com%2F2j4u4ae.jpg&hash=2911e141083c5b877527c262edf35fae0dd40737)
Title: Re: Level does not exists
Post by: KAKAN on Jul 15, 2016, 02:25 PM
There is either some problem with your onPlayerJoin or in the kick. It happens all the time or just with kick?
Title: Re: Level does not exists
Post by: Finch Real on Jul 15, 2016, 02:30 PM
As i already told you guys his kick function is bugged
Title: Re: Level does not exists
Post by: Cool 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
Title: Re: Level does not exists
Post by: KAKAN on Jul 15, 2016, 03:12 PM
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
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 03:19 PM
function Kick( player, admin, reason )
{
    Message( "Admin " + admin.Name + " Kicked " + player.Name + " for Reason: " + reason );
    KickPlayer( player );
         SaveStats( player );

}
Title: Re: Level does not exists
Post by: KAKAN on Jul 15, 2016, 03:33 PM
function Kick( player, admin, reason )
{
    Message( "Admin " + admin.Name + " Kicked " + player.Name + " for Reason: " + reason );
         SaveStats( player );
    player.Kick();
}
try that
Title: Re: Level does not exists
Post by: Finch Real on Jul 15, 2016, 04:34 PM
Now it will come to Show Savestats
Title: Re: Level does not exists
Post by: Cool on Jul 15, 2016, 04:37 PM
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 );
}
Title: Re: Level does not exists
Post by: KAKAN on Jul 15, 2016, 04:47 PM
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.
Title: Re: Level does not exists
Post by: Mötley on Jul 16, 2016, 02:37 AM
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 :)
Title: Re: Level does not exists
Post by: Cool on Jul 16, 2016, 06:22 AM
@Motley I don't have leaked script
Title: Re: Level does not exists
Post by: 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 );
}
}
}
Title: Re: Level does not exists
Post by: Cool on Jul 16, 2016, 07:43 AM
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
Title: Re: Level does not exists
Post by: Mötley on Jul 16, 2016, 12:13 PM
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.
Title: Re: Level does not exists
Post by: KAKAN on Jul 16, 2016, 12:18 PM
Quote from: Mötley on Jul 16, 2016, 12:13 PMThis 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.
That was just to give him an example. And you know what, GetTok is tons time slower than the native split method, so I prefer my way of coding. But, we should stop here, that was just an example code, I'm no longer a scripter in Squirrel, so, don't look at me to give you 100% right things, better ask Doom or SLC.
Title: Re: Level does not exists
Post by: Mötley on Jul 16, 2016, 12:27 PM
Well in apologies as to I never intended to make you feel like a bad scriptwriter or really anyone.

As a business person, As well employee, I had my reasonings of my post, posted In what you quoted above this post.
Title: Re: Level does not exists
Post by: KAKAN on Jul 16, 2016, 03:21 PM
Quote from: Mötley on Jul 16, 2016, 12:27 PMWell in apologies as to I never intended to make you feel like a bad scriptwriter or really anyone.

As a business person, As well employee, I had my reasonings of my post, posted In what you quoted above this post.

no lol, I didn't mean that. I just can't understand what you said that reading those scripts might give you cancer. I typed them roughly on NP++, so, didn't care about spaces or formatting or any other thing.
And by saying, bad scriptwriter, I mean, I left Squirrel scripting long ago, so, yes, I'm, that's the truth. I've my mood on Web Developing, Squirrel is of no use there :p
Title: Re: Level does not exists
Post by: Mötley on Jul 17, 2016, 01:33 AM
Quote from: Hercules on Jul 16, 2016, 06:22 AM@Motley I don't have leaked script

You pretend you are Pro scriptwriter when you prefer to use horible methods, Yet someone leads you on to better qualities in scripting but you prefer to use the same crappy methods you have been doing, I really wish someone would point me in a better yet quality dirrection as I would go for it, You are rather subburn sir.

I have a strong feeling you do have a leaky script, You should not take this as a bad thing.

There are many ways to take over servers that do not have proper methods,.

Simple Example:  I could crash your player in three seconds and your stats/arrays/etc will not clear, Allowing me to have a possibility to take over your [ Player.ID ] to take over your array and or class and give others legit accounts Admin, Then leave the server and use an legit account, I've done this before plenty of times when helping others bug test systems, Systems that are very very good systems.

It's all about manipulating the games time rate as well game engine client side.



But I'm not hear to teach how to bug test and take over a server as I do not play this old game, I only rarely check out servers "I've been doing this for to long 'GGM, MTA days' "


Quote from: Hercules on Jul 16, 2016, 07:43 AM
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

Why would you use this method.


When I was lead into better ways I was highly great full, KIDS these days act like your telling them what to do, Not the truth "Helping them out, Giving better qualities, Opening another's credentials". Thats what script help should come down to, Not do this code for me. I will admit I have seen Smexy coding with issues that deserve help, But it's impossible to help someone with fugly coding.



@KAKAN, I never said you were a bad scriptwriter, I'm not good myself, But I keep trying and studying hear and there everyday.
Title: Re: Level does not exists
Post by: Cool on Jul 17, 2016, 07:54 AM
@Mötley I think you do not have knowledge to know the script thats not a leaked script if i having a leaked so i will not in problem about a small cmd kick i think you like to saying its leak script and saying only myself script fine dont take wrong