21.11.2010, 01:05
SAVE DATA WITHOUT REGISTRATION
In this simple tutorial will teach you how to save some data to re-enter to continue taking the same, but without requiring a log (either by command or dialogues) is very useful to make some filterscript or similar, will used where you are more comfortable, they can also be used in GameMode. All you need will include "dini" which can be found on the forum.STEP 1: We should include, forgive the repetition, the include, so that its functions can be used in the GameMode / filterscripts. For that one used the following where are the other # includes.
pawn Код:
#include <Dini>
pawn Код:
new jugadornombre[30];
pawn Код:
GetPlayerName(playerid,jugadornombre,30); // Gets the name.
if(!dini_Exists(jugadornombre)) // Check if there.
dini_Create(jugadornombre); // Believe it.
else if(dini_Exists(jugadornombre)) // If not, get the data.
{
SetPlayerScore(playerid, dini_Int(jugadornombre,"Score"));// Create the file variable.
}
pawn Код:
GetPlayerName(playerid,jugadornombre,30); // Gets the name.
dini_IntSet(jugadornombre,"Score", GetPlayerScore(playerid)); // Save the data in the file.
STEP 5: Here comes the end, load the data file to the player. For this use the following code in OnPlayerSpawn:
pawn Код:
SetPlayerScore(playerid, dini_Int(jugadornombre,"Score")); //Load the data to the player.
Credits: Me.
To: PawnoScripting.
Note: I used ****** translator, since it is not English.
Note2: If you notice any errors, please let me know that for sure was confused, as I did here in the forum.
Note3: nombrejugador = Player Name.