Raised This Month: $51 Target: $400
 12% 

Array must be indexed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Riotline
AlliedModders Donor
Join Date: Oct 2015
Location: Half Life 3
Old 02-04-2017 , 22:01   Array must be indexed
Reply With Quote #1

Basically what is happening is that I am trying to use Client pref for some player settings for my plugin. What is happening is I'm using a hookevent (OnLoadoutReset = post_inventory_application) for resupply cabinets.

Since HookEvents don't come with a client argument I had to create my own:
Code:
    new player = GetClientOfUserId(GetEventInt(event, "userid"));
Inside this I have If Statements everywhere which is relying on the Client Prefs but it says that my array must be indexed even though it is:

Code:
if (ZM_SettingsPref[player] == "normal")
I do not know how to solve this.
__________________
Riotline is offline
Michael Shoe Maker
Senior Member
Join Date: Apr 2016
Old 02-04-2017 , 22:07   Re: Array must be indexed
Reply With Quote #2

Quote:
Originally Posted by Riotline View Post
Basically what is happening is that I am trying to use Client pref for some player settings for my plugin. What is happening is I'm using a hookevent (OnLoadoutReset = post_inventory_application) for resupply cabinets.

Since HookEvents don't come with a client argument I had to create my own:
Code:
    new player = GetClientOfUserId(GetEventInt(event, "userid"));
Inside this I have If Statements everywhere which is relying on the Client Prefs but it says that my array must be indexed even though it is:

Code:
if (ZM_SettingsPref[player] == "normal")
I do not know how to solve this.
PHP Code:
if(StrEqual(ZM_SettingsPref[player], "normal"

Last edited by Michael Shoe Maker; 02-04-2017 at 22:07.
Michael Shoe Maker is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-05-2017 , 23:06   Re: Array must be indexed
Reply With Quote #3

Also check if player == 0 and return if so.

A client could disconnect between the frame and the distribution of an event.
__________________
Neuro Toxin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode