Raised This Month: $ Target: $400
 0% 

Set all array to true


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fmfs10
Senior Member
Join Date: Mar 2009
Location: Brasil
Old 01-07-2011 , 11:01   Set all array to true
Reply With Quote #1

Hello! I'm trying to do a plugin with this array:

PHP Code:
new bool:g_playerFirstEnter_Menu[33][MAX_PAGES_MENU-1// Where 33 is the id of player and MAX_PAGES_MENU a define that sets max pages of a menu 
I tried to set every slot to true. But I don't know exactly how to do this, so I tried 2 ways:

PHP Code:
//client_putinserver(id)...
for(new 0MAX_PAGES_MENU-1i++)
    
g_playerFirstEnter_Menu[id][i] = true 
and:

PHP Code:
new bool:g_playerFirstEnter_Menu[33][MAX_PAGES_MENU-1] = {true, ...} 
But none of them works... What can I do?

Last edited by fmfs10; 01-07-2011 at 11:10.
fmfs10 is offline
ARES[ro]
Senior Member
Join Date: Apr 2010
Old 01-07-2011 , 11:17   Re: Set all array to true
Reply With Quote #2

You can use it as false lol... its a boolean. Just call it new bool:g_playerNotFirstEnter_Menu[33][MAX_PAGES_MENU-1]
__________________
okay
ARES[ro] is offline
fmfs10
Senior Member
Join Date: Mar 2009
Location: Brasil
Old 01-07-2011 , 11:23   Re: Set all array to true
Reply With Quote #3

Yeah but I need it to start already true... All the slots. Bools starts as false

And I think it's unnecessary set each slot to one by one.

There is no way to set all the slots to true in one time?
fmfs10 is offline
ARES[ro]
Senior Member
Join Date: Apr 2010
Old 01-07-2011 , 11:33   Re: Set all array to true
Reply With Quote #4

I am just saying that by doing that its less optimized code. Just use it as defaulted to 0 cuz man a boolean only has 2 values 1 and 0 so it doesnt change anything in ur code. I suggest u use it as false from the start never start as true.
PHP Code:
for(new 033e++)
    for(new 
0MAX_PAGES_MENU-1i++)
        
g_playerFirstEnter_Menu[e][i] = true 
Yes it is unnecessary just start as false... Its impossible to give it a constant value from the definition because its a 2 dimension array.
__________________
okay

Last edited by ARES[ro]; 01-07-2011 at 11:35.
ARES[ro] is offline
fmfs10
Senior Member
Join Date: Mar 2009
Location: Brasil
Old 01-07-2011 , 11:43   Re: Set all array to true
Reply With Quote #5

I tried again the putinserver thing and it worked now. LOL
I don't now why o.O

Thanks anyway... I discovered a new think now ^^
fmfs10 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-07-2011 , 12:25   Re: Set all array to true
Reply With Quote #6

try
Code:
public client_putinserver(id)
    arrayset(g_playerFirstEnter_Menu[id], true, MAX_PAGES_MENU - 1);
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 02:01.


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