Need some answers.
#2

There's no such thing as a string in pawn, it's just an array of " X * cell" and you can assign each cell one character.

In order to assign each cell with a character people designed format. Using format like this:

pawn Код:
new str[64];
format(str, 64, "Hello");
is SORT OF equal to
pawn Код:
for(new i = 0; i < 64; i++)
{
    if(i<arraysize)
    {
        string[i] = array[i];
    }
    else
    {
        string[i] == 0;
        break;
    }
}
While format would be an equivalant of:
pawn Код:
format(string, loopmax, array);

For your other question, you should use OnPlayerStateChange because OnPlayerUpdate is called WHENEVER something changes for the user which is pretty much ALL THE TIME resulting in the function literally being called almost every TICK. OnPlayerStateChange ONLY gets called when the STATE changes of the player.


EDIT:

And I forgot to mention that this obviously simplifies the insertion of other strings or data into an array e.g.

pawn Код:
new number, new Float:floats, new str[128], new hello[32];

format(hello, 32, "Hello");

number = 1;
floats = 2.0;

format(str, 128, "Hello: %s Number: %d Float: %f", hello, number, floats);
EDIT2:

pawn Код:
%s = string
%d = double (same as integer, theres no difference for pawn)
%i = integer (aka number)
%f = float (aka floating point number aka 1.123456)
Just so you understand the example above!


Hope it helps,
Regards.
Reply


Messages In This Thread
Need some answers. - by Faisal_khan - 09.06.2012, 06:13
AW: Need some answers. - by Extremo - 09.06.2012, 06:22
Re: Need some answers. - by MP2 - 09.06.2012, 06:38
Re: Need some answers. - by Rudy_ - 09.06.2012, 07:13
Re: Need some answers. - by Faisal_khan - 09.06.2012, 07:27
AW: Need some answers. - by Extremo - 09.06.2012, 07:28
Re: Need some answers. - by Faisal_khan - 09.06.2012, 07:36
AW: Need some answers. - by Extremo - 09.06.2012, 07:46
Re: Need some answers. - by Faisal_khan - 09.06.2012, 07:50
Re: Need some answers. - by MadeMan - 09.06.2012, 07:51

Forum Jump:


Users browsing this thread: 1 Guest(s)