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

[CSS] Error array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Old 05-03-2012 , 07:33   [CSS] Error array
Reply With Quote #1

Hello,

I have this code and it's an error

Code:
L 05/03/2012 - 13:22:49: [SM] Plugin encountered error 15: Array index is out of bounds
I don't understand

Could you me help please ?

Thanks in advance !
__________________
♥ 𝕊ℙ𝕒𝕨𝕟 𝔻𝕖𝕧𝕖𝕝𝕠𝕡𝕖𝕣 [ℂ𝕊:𝕊] ♥

Clan-Nemesis
delachambre is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 05-03-2012 , 07:41   Re: [CSS] Error array
Reply With Quote #2

Post your Code

Yours sincerely
Impact
__________________
Impact123 is offline
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Old 05-03-2012 , 08:16   Re: [CSS] Error array
Reply With Quote #3

Code:
public Vente_Cb(Handle:menu, MenuAction:action, client, param2) 
{ 
	if (action == MenuAction_Select) 
	{ 
		new String:info[32]; 
		GetMenuItem(menu, param2, info, sizeof(info)); 
			
		new MoneyOffset = FindSendPropOffs("CCSPlayer", "m_iAccount");

		if (StrEqual(info, "oui")) 
		{ 
			if (bank[client] >= 1500)
			{
				PrintToChat(TransactionWith[client], "%s : Le client %N a accepter.", LOGO, client); 
				PrintToChat(client, "%s : Achat réalisé avec succès.", LOGO); 
				bank[client] = bank[client] - 1500;
				AdCash(TransactionWith[client], 1500);
				cb[client] = 1;
				
				capital[banque] = capital[banque] + 750;
				
				SetEntData(client, MoneyOffset, money[client], 4, true);
			}
			else
			{
				PrintToChat(client, "%s : Vous n'avez pas assez d'argent.", LOGO); 
			}
		} 
		else if (StrEqual(info, "non")) 
		{ 
			PrintToChat(TransactionWith[client], "%s : Le client %N a refusé.", LOGO, client); 
		} 
	} 
	else if (action == MenuAction_Cancel) 
	{ 
		TransactionWith[client] = 0; 
		 
		for(new i=1; i < MaxClients; i++) 
		{ 
			if(IsClientInGame(i) && TransactionWith[i] == client) 
				TransactionWith[i] = 0; 
		} 
	} 
	else if (action == MenuAction_End) 
	{ 
		CloseHandle(menu); 
		 
		TransactionWith[client] = 0; 

		for(new i=1; i < MaxClients; i++) 
		{ 
			if(IsClientInGame(i) && TransactionWith[i] == client) 
				TransactionWith[i] = 0; 
		} 
	} 
}
__________________
♥ 𝕊ℙ𝕒𝕨𝕟 𝔻𝕖𝕧𝕖𝕝𝕠𝕡𝕖𝕣 [ℂ𝕊:𝕊] ♥

Clan-Nemesis
delachambre is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-03-2012 , 08:18   Re: [CSS] Error array
Reply With Quote #4

Replace:
for(new i=1; i < MaxClients; i++)

With:
for(new i=1; i <= MaxClients; i++)


Show us how the bank array is defined? Should be MAXPLAYERS+1
__________________
Silvers is offline
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Old 05-03-2012 , 08:23   Re: [CSS] Error array
Reply With Quote #5

The bank is defined
__________________
♥ 𝕊ℙ𝕒𝕨𝕟 𝔻𝕖𝕧𝕖𝕝𝕠𝕡𝕖𝕣 [ℂ𝕊:𝕊] ♥

Clan-Nemesis
delachambre is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-03-2012 , 08:27   Re: [CSS] Error array
Reply With Quote #6

How? Show...

It would help if you showed the full error message, the line number etc. And show how you defined "capital", "banque", "bank" etc.
__________________

Last edited by Silvers; 05-03-2012 at 08:28.
Silvers is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-03-2012 , 09:09   Re: [CSS] Error array
Reply With Quote #7

If you have a variable looking like this one:

PHP Code:
new x]; // 3 cells 
You will only be able to work with these cells:

PHP Code:
x] = 32// 1
x] = 256// 2
x] = 'a'// 3

x[ -] = 32// INDEX OUT OF BOUNDS
x] = 13// INDEX OUT OF BOUNDS
x25655 ] = 236// INDEX OUT OF BOUNDS 
__________________

Last edited by claudiuhks; 05-03-2012 at 09:11.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Old 05-03-2012 , 11:11   Re: [CSS] Error array
Reply With Quote #8

Code:
new money[MAXPLAYERS+1];
new bank[MAXPLAYERS+1];
new h[MAXPLAYERS+1];
__________________
♥ 𝕊ℙ𝕒𝕨𝕟 𝔻𝕖𝕧𝕖𝕝𝕠𝕡𝕖𝕣 [ℂ𝕊:𝕊] ♥

Clan-Nemesis
delachambre is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 05-03-2012 , 15:08   Re: [CSS] Error array
Reply With Quote #9

please, show whole error. It tells witch line it happen.
*edit
waht is this ?
TransactionWith[]

Last edited by Bacardi; 05-03-2012 at 15:09.
Bacardi is offline
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Old 05-03-2012 , 16:17   Re: [CSS] Error array
Reply With Quote #10

Thread solved.
__________________
♥ 𝕊ℙ𝕒𝕨𝕟 𝔻𝕖𝕧𝕖𝕝𝕠𝕡𝕖𝕣 [ℂ𝕊:𝕊] ♥

Clan-Nemesis
delachambre 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 23:44.


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