2 questions %i and setting admin
I tryed searching which is more useful or best to use %i OR %d for integer values
are there some privilegs using 1 to other. And when Player already is admin. lets say I want to remove admin, but not from the sql database and then PHP Code:
PHP Code:
which is faster setting using array as boolean or integer PHP Code:
and is there a way to set values "false" or / 0 in array without going through all array. example global_variable[16] = true; global_variable[129] = true; global_variable[3] = true; is there a quick way like setting string array to 0 as global_variable[0] = 0; but can you do the same for bool / int array |
Re: 2 questions %i and setting admin
%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:
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. |
Re: 2 questions %i and setting admin
set_user_flags does not remove existing flags, it just adds to them. So you need to use remove_user_flags first, then set_user_flags
|
Re: 2 questions %i and setting admin
arrayset works, thanks for that.
PHP Code:
|
Re: 2 questions %i and setting admin
Quote:
This is the native and it can be found in amxmodx.cpp. Code:
|
| All times are GMT -4. The time now is 10:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.