23.03.2012, 17:19
(
Последний раз редактировалось [LoD]Hauke; 24.03.2012 в 10:02.
)
HSA is the probably the easiest way to store data in a file.
There is always a function for reading and for writing strings, integers and floats.
Of course, HSA has some advantages to other includes, which are provided for storing.
From the values of the arithmetic mean was determined.
You can see, that HSA is faster. (This chart is based on writing & reading single entries)
Functions:
Files are created automatically.
Examples:
There is always a function for reading and for writing strings, integers and floats.
Of course, HSA has some advantages to other includes, which are provided for storing.
- HSA is very easy to use!
- HSA is normally faster than other includes
- HSA secures data automatically
From the values of the arithmetic mean was determined.
You can see, that HSA is faster. (This chart is based on writing & reading single entries)
Functions:
- getInt:
pawn Код:getInt:"Filename"("Datasetname");
Returns the saved integer "Datasetname" in the file "Filename". - getFloat:
pawn Код:getFloat:"DateiName"("Datasetname");
Returns the saved float "Datasetname" in the file "Filename". - getString:
pawn Код:getString:"DateiName"("Datasetname");
Returns the saved text "Datasetname" in the file "Filename". - setInt:
pawn Код:setInt:"DateiName"("Datasetname",12356789);
Saves the integer "12356789" in the file "Filename" under the name "Datasetname". - setFloat:
pawn Код:setFloat:"DateiName"("Datasetname",1234.56789);
Saves the float "1234.56789" in the file "Filename" under the name "Datasetname". - setString:
pawn Код:setString:"DateiName"("Datasetname","Any text");
Saves the text "Any text" in the file "Filename" under the name "Datasetname".
Files are created automatically.
Examples:
- Easy saving of players:
pawn Код:new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
setString:PlayerName("password","I like trains");
setInt:PlayerName("money",4125);
setFloat:PlayerName("health",74.12);
printf("the players password is %s",getString:PlayerName("password"));
printf("%s has %d$.",PlayerName,getInt:PlayerName("money"));
printf("%s has %f health.",PlayerName,getFloat:PlayerName("health")); - Easy fraction cash system:
pawn Код:setInt:"fraction_money"("police",81921);
setInt:"fraction_money"("firedepartment",56121);
setInt:"fraction_money"("yakuza",1912);
setInt:"fraction_money"("lufthansa",917251);
printf("Die police has %d$",getInt:"fraction_money"("police"));
printf("Die fire department has %d$",getInt:"fraction_money"("firedepartment"));
printf("Die yakuza has %d$",getInt:"fraction_money"("yakuza"));
printf("Die lufthansa has %d$",getInt:"fraction_money"("lufthansa"));
When storing data was ever so simple?
Links: