[Tutorial] Save data without registration
#1

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>
STEP 2: First of all we must make a "new" to find out the name of the player. To do this will the following below the # includes <>
pawn Код:
new jugadornombre[30];
STEP 3: Now we go to OnPlayerConnect, everything happens there when the player connects. We will: Find the name of the player, check if file exists if not create it there, if the data. For that, we will:
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.
}
STEP 4: In this way we save the data file created player to connect. As follows. Then, use the following code
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.
Reply


Messages In This Thread
Save data without registration - by [J]ulian - 21.11.2010, 01:05
Re: Save data without registration - by Lorenc_ - 21.11.2010, 06:30
Re: Save data without registration - by HyperZ - 26.11.2010, 11:31
Re: Save data without registration - by -Rebel Son- - 09.12.2010, 02:35
Re: Save data without registration - by admantis - 09.12.2010, 04:56
Re: Save data without registration - by Haydz - 09.12.2010, 11:17
Re: Save data without registration - by xFirex - 20.06.2013, 16:43
Respuesta: Re: Save data without registration - by [DOG]irinel1996 - 20.06.2013, 18:30

Forum Jump:


Users browsing this thread: 1 Guest(s)