28.10.2014, 20:10
Hello there
I'm making a tiki system (like horse shoes) where a player has to find 25 tikis that are hidden in the server.
One of the most important things about this is that even when a player has disconnected their tikis (the ones they've already found) remain 'found'.
I did this by making a 25 character string, where each character (either 0 or 1) represents each tiki.
So if a player has found tiki id 1, 2, 7 and 25 this is the string:
I then save this string in a database (so I do not have to make a new cel for every single tiki)
Now the saving works, when a player disconnects the string is properly saved, and when a player connects the string is properly loaded.
However I have some trouble turning the string (which now consists of characters 0 and 1) into integer values for each tiki
So this:
Should become this:
I tried doing this with the following code:
So what I try to do here is I start a loop goin from 0 to 25 and I then store the value of the string for a specific tikiid into the corresponding tiki.
But this does not seem to work :/
Does anyone know how I can make this work properly?
Any help is well appreciated![Smiley](images/smilies/smile.png)
Thanks in advance
I'm making a tiki system (like horse shoes) where a player has to find 25 tikis that are hidden in the server.
One of the most important things about this is that even when a player has disconnected their tikis (the ones they've already found) remain 'found'.
I did this by making a 25 character string, where each character (either 0 or 1) represents each tiki.
So if a player has found tiki id 1, 2, 7 and 25 this is the string:
Код:
1100001000000000000000001
Now the saving works, when a player disconnects the string is properly saved, and when a player connects the string is properly loaded.
However I have some trouble turning the string (which now consists of characters 0 and 1) into integer values for each tiki
So this:
pawn Код:
1100001000000000000000001
pawn Код:
PInfo[playerid][FoundTiki][0] = 1; //Where 0 stands for the tiki id
PInfo[playerid][FoundTiki][1] = 1; //Where 1 stands for the tiki id
PInfo[playerid][FoundTiki][2] = 0; //Where 2 stands for the tiki id
pawn Код:
for(new ti; ti < sizeof TIInfo; ti ++) //TIInfo is an array that contains information for all tikis, so its size equals the total amount of tikis in the server
{
PInfo[playerid][FoundTiki][ti] = strval(PInfo[playerid][TikiString][ti]); //convert each char into an int
}
But this does not seem to work :/
Does anyone know how I can make this work properly?
Any help is well appreciated
![Smiley](images/smilies/smile.png)
Thanks in advance