12.10.2011, 15:39
I have an Admin System that it's very good, but the problem is that I can't save score/kills/deaths/money/color name. It saves the accounts, the level and times someone mute/jail.
I add this FS to see if the above saves, but nothing.
The problem is that I make new FS and must add it on Admin System, or it's ok with that.
Then if it's ok why don't save although it compiles without warnings/errors.
I add this FS to see if the above saves, but nothing.
The problem is that I make new FS and must add it on Admin System, or it's ok with that.
Then if it's ok why don't save although it compiles without warnings/errors.
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <Dini> // This include is use for saving data's
#include <Dutils> // This include is used for some important function
#include <Dudb> // This include is used for hashing password
#pragma unused ret_memcpy
#define savefolder "/stats/%s.ini"
//= VARIAVEL
new Killz[MAX_PLAYERS];
new Deathz[MAX_PLAYERS];
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
new pname[128]; // This get's the length of the player name
new file[128]; // This get's the lenght of the file
GetPlayerName(playerid, pname, sizeof(pname));// This get's the player name with the lenght of the player name
format(file, sizeof(file), savefolder,pname); // This describe's where to save and how to save it
if(!dini_Exists(file)) { // If the file exist
dini_Create(file); // Create the file
dini_IntSet(file, "Score", 0); // Set's "Score"
dini_IntSet(file, "Money", 0); // Set's "Money"
// Set's "Kills"
dini_IntSet(file, "Kills", Killz[playerid]);
// Set's "Deaths"
dini_IntSet(file, "Deaths", Deathz[playerid]);
dini_IntSet(file, "Skin", 0); // Set's Skin
// This describes where to load the score
SetPlayerScore(playerid, dini_Int(file, "Score"));
// This describes where to load the money
SetPlayerMoney(playerid, dini_Int(file, "Money"));
// This describes where to load the skin
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
// and at last this set's the value which were on the file
}
else {
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPlayerMoney(playerid, dini_Int(file, "Money"));
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
// the same thing
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new pname[128]; // The name length
new file[128]; // The file length
GetPlayerName(playerid, pname, sizeof(pname));// This get's the player name with the name length
format(file, sizeof(file), savefolder,pname); // Formatting file
if(!dini_Exists(file)) { // If the file exist
}
else { // if not
// This Get the Score
dini_IntSet(file, "Score", GetPlayerScore(playerid));
// This Get the cash
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
// This get the kills
dini_IntSet(file, "Kills", Killz[playerid]);
// This get the Deaths
dini_IntSet(file, "Deaths", Deathz[playerid]);
// This get the skin
dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
}
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
Killz[killerid] ++; // The killer value will be increased
Deathz[playerid] ++; // The death value will be increased
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0) {
// Do something here
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}