String formatting and unformatting problem
#1

Hello

I'm making a tiki system, where the player has to find 25 tikis that are hidden in the world.
Now everything works flawless, however I have a problem saving which tikis have already been found by a player and which are yet to be tracked.

Now here's how I want to do this:
pawn Код:
PInfo[MAX_PLAYERS][FoundTiki[MAX_TIKIS]]
That's the array, so when a player picks up a tiki all I do is set
pawn Код:
PInfo[playerid][FoundTiki[FoundTiki]] = 1;
Well this all works perfect however when a player disconnects I'm trying to format wether or not the player has found a tiki in a string, using this code:
pawn Код:
for(new ti; ti < sizeof TIInfo; ti ++)
    {
        format(PInfo[playerid][TikiString], MAX_TIKIS, "%s%d", PInfo[playerid][TikiString], PInfo[playerid][FoundTiki][ti]);
    }
Well this should format the following string when for example a player has found the first and second last tiki: [CODDE]1000..10[/CODE]
1 Saying that the player has found the specific tiki
0 saying that the player hasn't yet found the tiki

But unfortunately this doesn't work, the string is formatted wrong all the time and I don't know why...
Please tell me how to do this correctly :/

Also another thing, when I read the tikistring from the database, I would like to convert the string into values so this:

Код:
100..10
Becomes this:
Код:
PInfo[playerid][FoundTiki][0] = 1; //Tiki id 0 has been found by the player
PInfo[playerid][FoundTiki][1] = 0;  //Tiki id 1 hasn't been found, hence value 0

And so forth
BUt I don't know how I can read wether a player has already found a certain tiki or not from this string

Thanks in advance
Reply


Messages In This Thread
String formatting and unformatting problem - by knackworst - 27.10.2014, 19:06
Re: String formatting and unformatting problem - by nemesis- - 28.10.2014, 00:48
Re: String formatting and unformatting problem - by Abagail - 28.10.2014, 00:55
Re: String formatting and unformatting problem - by Quickie - 28.10.2014, 01:24
Re: String formatting and unformatting problem - by knackworst - 28.10.2014, 14:52

Forum Jump:


Users browsing this thread: 1 Guest(s)