server not saving stats
#1

hello ,


I've experienced a weird bug in which the server doesn't save any stats , but i can't find the problem. if anyone can help me with this. nvm the hit script in OnPlayerDisconnect , but i can't get why it isn't saving. if anyone can help me then 100 thank you


Quote:

public OnPlayerConnect(playerid)
{
new string[256], playername[MAX_PLAYER_NAME], file[255];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s has joined Cops N Robbers RolePlay!", playername);
Announce(string);
IsPlayerLogged[playerid] = 0;
RecentlyRobbed[playerid] = 0;
SelectBM[playerid] = 0;
AMMUBOX[playerid] = 0;
CSKINZ[playerid] = 0;
CSKINU[playerid] = 0;
CSKIN[playerid] = 0;
CHALLBOX[playerid] = 0;
IcmdCar[playerid][CarcmdI] = -1;
IsSpawned[playerid] =0;
GPSTimer[playerid] = 0;
HaveGPS[playerid] = false;
Muted[playerid] = 0;
AccountInfo[playerid][aLevel] = 0;
//Text Draws
TextDrawShowForPlayer(playerid, BOX);
TextDrawShowForPlayer(playerid, Welcome);
TextDrawShowForPlayer(playerid, text1);
TextDrawShowForPlayer(playerid, text2);
TextDrawShowForPlayer(playerid, text3);
HaveTicket[playerid] = false;
new Registre[250];
if(fexist(file))


return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new string[256], playername[MAX_PLAYER_NAME], file[256];
PlayersOnline--;
GetPlayerName(playerid, playername, sizeof(playername));
format(file, sizeof(file), "%s", playername);
format(string, sizeof(string), "%s has left Cops and Robbers RolePlay!", playername);
Announce(string);
IsPlayerLogged[playerid] = 0;
RecentlyRobbed[playerid] = 0;
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "Admin", AccountInfo[playerid][aLevel]);
dini_IntSet(file, "WantedLevel", GetPlayerWantedLevel(playerid));
if(IcmdCar[playerid][CarcmdI] != -1) UcideMasinileBoule(IcmdCar[playerid][CarcmdI]);
if(playerInJob[playerid]>0)
{
terminarMission(playerid);
}
OnTaxiAsPassenger[playerid]=-1;
if (playerInMiniMission2[playerid]>0)
{
terminarMission2(playerid);
}
OnBusAsPassenger[playerid]=-1;
SelectBM[playerid] = 0;
AMMUBOX[playerid] = 0;
CSKINZ[playerid] = 0;
CSKINU[playerid] = 0;
CSKIN[playerid] = 0;
CHALLBOX[playerid] = 0;
AccountInfo[playerid][aLevel] = 0;
if(HaveGPS[playerid]) {
KillTimer(GPSTimer[playerid]);
HaveGPS[playerid] = false;
GPSTimer[playerid] = 0;
}
if(hit[playerid] > 0)
{
format(string, sizeof(string), "The hit on %s (%i) has been cancelled (disconnected)", ReturnPlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_MSG, string);
hit[playerid] = 0;
}
return true;
}

Reply
#2

Please take a look at some tutorials, that's not the correct way to save/load with Dini.

For example, in OnPlayerConnect:
pawn Код:
new file[256];
if(fexist(file))
The file you're trying to check whether exists or not is null. Plus, 256 is waste, even 40 would be a lot.

In OnPlayerDisconnect, a file with just a name is not something (I've seen) that is used in samp so far. Use an extension.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)