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

Variable not set on event..?


Post New Thread Reply   
 
Thread Tools Display Modes
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 05-27-2017 , 09:36   Re: Variable not set on event..?
Reply With Quote #11

This is to fix the out of bounds error your loop was throwing. To help you make sense of this, MaxClients is a dynamic variable that holds the number of possible clients that server can have. It's probably a bigger number than 31, the max index of your previous array, hence the error. It doesn't matter if there are any clients in the server when you use it.
__________________

Last edited by Impact123; 05-27-2017 at 09:38.
Impact123 is offline
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 05-27-2017 , 09:42   Re: Variable not set on event..?
Reply With Quote #12

Quote:
Originally Posted by Impact123 View Post
This is to fix the out of bounds error your loop was throwing. To help you make sense of this, MaxClients is a dynamic variable that holds the number of possible clients that server can have. It's probably a bigger number than 31, the max index of your previous array, hence the error. It doesn't matter if there are any clients in the server when you use it.
Ooh, okay! Thanks for the explanation, at the very least I understand the error I got now!

So how can I set the whole array to 0?
condolent is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 05-27-2017 , 09:51   Re: Variable not set on event..?
Reply With Quote #13

What you did was fine, just without the client check
PHP Code:
public void OnMapStart()
{
    for (
int i=1<= MaxClientsi++)
    {
        
RespawnNumber[i] = 0;
        
RespawnLeft[i] = Number;
    }

__________________
Impact123 is offline
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 05-27-2017 , 09:53   Re: Variable not set on event..?
Reply With Quote #14

Quote:
Originally Posted by Impact123 View Post
What you did was fine, just without the client check
PHP Code:
public void OnMapStart()
{
    for (
int i=1<= MaxClientsi++)
    {
        
RespawnNumber[i] = 0;
        
RespawnLeft[i] = Number;
    }

It's working! Thank everyone for the help, I am forever grateful!
condolent 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 01:14.


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