Raised This Month: $ Target: $400
 0% 

2 questions %i and setting admin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 01-16-2014 , 13:54   Re: 2 questions %i and setting admin
Reply With Quote #2

%i and %d are the same.

An array is always initialized as 0, 0.0 or false depending on the tag. If you don't do anything all cells will have that value.
Do you mean clearing an array that has been set? If so, arrayset() is a useful function.
Code:
    new myArray[512];     arrayset(myArray, 0, sizeof myArray);

I do believe (I'm not sure) that booleans are basically integers in PAWN. So I don't think you would see an improvement using booleans. Either way, if your array only has 2 values (0 and 1) it's considered good practice too use a boolean.
If you have less than 32 values in that array you can use bitmasking on one integer instead. I don't know if it is more efficient, but it probably is. It is harder to read and understand though. That can easily be solved by some macros.

Clearing a string by setting the first cell to 0 is really a lie. Most string related functions will stop once it hits 0 so no function will process the string beyond that first cell, but all the other cells still remains. There's no point of using arrayset() because most functions will create a new null at the end of the string.

I don't have an answer to the admin/flags question.
__________________
Black Rose is offline
 



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 10:06.


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