Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Eva on Aug 08, 2016, 09:51 PM

Title: error index tointeger does not exist
Post by: Eva on Aug 08, 2016, 09:51 PM
I have this error when trying to buy a car, but before it worked.

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FRy4cmom.png&hash=d714c0550baa200656da8962c1065d7a0b3f2464)
Title: Re: error index tointeger does not exist
Post by: Mötley on Aug 08, 2016, 10:09 PM
Why are you not loading the data into an array or class?

as this is partial your issue. You might also have a lagy script because of it.

Cash <- array(GetMaxPlayers(), 0);
else if ( Cash[player.ID] < 1 )
on login you should have something in the method of

          Kills[player.ID] = GetSQLColumnData( q, 0 );
          Deaths[player.ID] = GetSQLColumnData( q, 1 );
          Cash[player.ID] = GetSQLColumnData( q, 2 );

This way you just update the arrays or class.

also never use player.Cash create your own function it's highly exploitable.

Try to update your cash system as well account system.

for a money system use something like

function SetCash(player, amount) {
  Cash[player.ID] += amount;
  player.Cash = Cash[player.ID];

}

usage is SetCash(player, 100); for a positive amount

SetCash(player, -100); for a negative amount


I'm telling you it's highly needed and good methods of scripting
Title: Re: error index tointeger does not exist
Post by: . on Aug 08, 2016, 10:13 PM
Most likely that GetColumnData() returned a null value after an error or something. That's one of the issues with the official SQLite plugin. That it does not report errors. So you're left to wonder why doesn't your code work. I'd suggest using this instead (http://forum.vc-mp.org/?topic=420.0).

It's indicated that you validate the values that you retrieve from database. So you don't end up calling methods on the wrong value type.

In fact, you can even see in the image that 'q' is NULL. Therefore, your query did not return anything.
Title: Re: error index tointeger does not exist
Post by: Eva on Aug 09, 2016, 07:54 AM
Thank you guys, i will have a look into it tonight and try to fix this.
Title: Re: error index tointeger does not exist
Post by: PunkNoodle on Aug 09, 2016, 09:20 AM
Quote from: Mötley on Aug 08, 2016, 10:09 PMalso never use player.Cash create your own function it's highly exploitable.
Why do you think player.Cash is exploitable? Don't take it as a critic, mine's a sincere question.
Title: Re: error index tointeger does not exist
Post by: Mötley on Aug 09, 2016, 10:51 AM
Well @...kneedl_ I am very very good at memory addresses, and as a scripter I always check for ways to break my system, When I noticed I can eventually change the memory addresses with forced entry points and save the hacked cash to my account I knew it was a no no to use player I cash,.


So with that I basically use that function above

function SetCash(player, amount) {
  Cash[player.ID] += amount;
  player.Cash = Cash[player.ID];

}

Yes it can be a little annoying but it's worth it, let alone eventually cracking player.Cash is annoying to but If I can do it so can someone else. And that's a exploit that's best to stay away from as I prefer to not remove everyones cash from there accounts due to exploits I could of prevented.

It's best to create your own function for wanted level as well Armour and Health I just have not gotten that far. Player.Skin is exploitable when saving to accounts as well BUT that's only helpful when you have to buy skins. I can go into stronger detail if needed..
Title: Re: error index tointeger does not exist
Post by: Kewun on Aug 09, 2016, 01:57 PM
You cant.
Title: Re: error index tointeger does not exist
Post by: Thijn on Aug 09, 2016, 04:10 PM
You should never rely on the client when it comes to something like money. While it might be tricky to modify, it's certainly not impossible.
A client could never modify server-side values though. So just to be safe, keep track of money server-side.
Title: Re: error index tointeger does not exist
Post by: Stormeus on Aug 09, 2016, 07:00 PM
I don't believe the client can manipulate player.Cash in 0.4.
Title: Re: error index tointeger does not exist
Post by: Kewun on Aug 09, 2016, 07:02 PM
ofc, there exists client script exploit in lu, but in vcmp is impossible..
Title: Re: error index tointeger does not exist
Post by: . on Aug 09, 2016, 07:10 PM
Quote from: Stormeus on Aug 09, 2016, 07:00 PMI don't believe the client can manipulate player.Cash in 0.4.

Quote from: Kewun on Aug 09, 2016, 07:02 PMofc, there exists client script exploit in lu, but in vcmp is impossible..

Depends on who does the scripting. Scripting without knowing what you're doing is the same as making the impossible into possible. And you cannot argue with me on that.
Title: Re: error index tointeger does not exist
Post by: Mötley on Aug 09, 2016, 09:08 PM
There are methods I used on "My server" that work, I could also use the same methods on another server but IT'S HIGHLY ILLEGAL with saying that now you possibly know what I am doing, if not thats great, I will not explain this to anyone. As it's really brutal and illegal if used on someones host. I really did not want to go any further into this. Not many will know how to do this as well be capable so there is not much worries, Thats why I do this as I said
Quotegood methods of scripting

The possibility is rare. It takes a lot of time. as well really irritating. just remember this if you have a really good server, Mainly a RPG server.
I'm not hear to wreak your server. I had no intension of sharing as of why, just giving a pointer without saying anything.

Title: Re: error index tointeger does not exist
Post by: EK.IceFlake on Aug 09, 2016, 10:48 PM
Illegal, by law, by technical limitation, or by ethics?
Title: Re: error index tointeger does not exist
Post by: Mötley on Aug 10, 2016, 12:06 AM
I prefer not to say.. requesting a lock
Title: Re: error index tointeger does not exist
Post by: Thijn on Aug 10, 2016, 05:55 AM
Quote from: Mötley on Aug 10, 2016, 12:06 AMI prefer not to say.. requesting a lock
I'm requesting for you to PM the method to a developer.

@Eva has not responded if the issue is fixed, so until then this topic remains open.
Title: Re: error index tointeger does not exist
Post by: KAKAN on Aug 10, 2016, 08:49 AM
Quote from: EK.CrystalBlue on Aug 09, 2016, 10:48 PMIllegal, by law, by technical limitation, or by ethics?
Some things can be illegal if you use common sense. This is the law of VCMP.
Storing passwords in plain text is not illegal by law, still then, Finch got banned for it. That's because he doesn't have common sense.
Title: Re: error index tointeger does not exist
Post by: . on Aug 10, 2016, 10:11 AM
This topic was marked as solved by it's author. Just because the OP had the decency of not locking this topic in case someone else encounters a similar issue and wishes to expand on the subject (also because it's common sense to not lock every topic). Does not give you the right to debate ethics and all the off-topic crap that can come out of your keyboard.
Title: Re: error index tointeger does not exist
Post by: Stormeus on Aug 10, 2016, 04:51 PM
Quote from: Thijn on Aug 10, 2016, 05:55 AM
Quote from: Mötley on Aug 10, 2016, 12:06 AMI prefer not to say.. requesting a lock
I'm requesting for you to PM the method to a developer.

@Eva has not responded if the issue is fixed, so until then this topic remains open.

In all honesty, unless it's some sort of remote code execution, it's probably a WONTFIX. Client-side scripts can't do anything like modifying player health or speed as it's all read-only, and with a proper script you shouldn't be able to accomplish more than forging a server packet that makes a GUI appear. If the server is scripted properly, this should have no effect on gameplay.