![]() |
getting an index
I'm having a little trouble here.
I'm making a bounty system, the account and the amount of money for that bounty will be placed in an array like this: this.bounty = {{"Frankie", 2000}, {"TSAdmin", 1500}}; when a player dies I want to check if they are in the list, but I can't do that because I'm having trouble checking the index. function onCreated() { this.array = {{"Frankie", 2000}, {"TSAdmin", 1500}}; this.getIndex = this.array.index("Frankie"); sendtorc(this.getIndex); } returns -1. I need it to return 0 this way I can do: this.moneyAmount = this.array[this.getIndex][1]; there's something I'm missing but TSA and I can't figure it out. |
Try maybe:
PHP Code:
PHP Code:
|
You can't get the index of a subaray in an array without a loop.
PHP Code:
|
You're probably better off just storing them all in variables like:
PHP Code:
PHP Code:
PHP Code:
|
| All times are GMT +2. The time now is 12:08 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.