Efficient way using RAW File Proccessor -
||123|| - 21.08.2011
Using 'format' like a hundred times doesn't looks like the most efficient way to script a file reading. I'm really confused at this and will appreciate if someone told me a better way to get around this.
Re: Efficient way using RAW File Proccessor -
Bakr - 21.08.2011
What do you mean using format? The only time you'd have to use that is formatting the player's name and directory of the INI file (assuming that's even how you save the files).
Re: Efficient way using RAW File Proccessor -
||123|| - 21.08.2011
Using 'format', for example, getting a player's AdminLevel. First we will have to use 'PlayerInfo[playerid][pInfo]' and save it in a string. Then we can write it in the user file. That 'format'
Re: Efficient way using RAW File Proccessor -
Bakr - 21.08.2011
Ah, I suppose you're correct there. However, there is nothing wrong with using the format function! You also wouldn't need to use the function more than once, as long as you format all values into one line:
pawn Code:
format(
write, sizeof( write ), "Password=%s\r\nAdminLevel=%i\r\nScore=%i",
PlayerInfo[ playerid ][ Password ],
PlayerInfo[ playerid ][ AdminLevel ],
GetPlayerScore( playerid )
);
The reason the more modern day INI systems don't use format to write to the file, at least not after the initial data is already in the file, is because they store what is read into variables.
Re: Efficient way using RAW File Proccessor -
||123|| - 21.08.2011
Alright thank you. Also, I would like you to ask you, why have you used the %i, instead of %d. As, GetPlayerScore and PlayerAdminLevel will be in numericals. I don't know what does %i does btw. Thanks for the reply.
Re: Efficient way using RAW File Proccessor -
sleepysnowflake - 21.08.2011
%i = %d. Integer or number. Without deciaml or so. Like 1, 2 or 19293. Not 99.7. That's a float.
Wiki link:
https://sampwiki.blast.hk/wiki/Format
Re: Efficient way using RAW File Proccessor -
||123|| - 21.08.2011
Quote:
Originally Posted by Berlovan
|
So you mean it saves the value just like a float does, but only without a decimal?
Re: Efficient way using RAW File Proccessor -
Bakr - 21.08.2011
Both %i and %d do the same thing, I just prefer to use %i.
Re: Efficient way using RAW File Proccessor -
sleepysnowflake - 21.08.2011
It is used for saving a whole number. It does not work as a float. You can try that yourself! Use Pawno and the main() function. Let me give you an example!
new Float:a, Float:b;
main()
{
a = 10;
b = 5;
printf("a/b = %d",floatdiv(a,b));
}
Re: Efficient way using RAW File Proccessor -
||123|| - 21.08.2011
Thank you. +Rep for both of you.