[Ajuda] Problemas salvamento
#1

estou com problema no salvamento do score dos jogadores, tipo tem vez que o score nгo salva, e tem vez que salva.
o codigo nгo tem nenhum erro .

Код:
#include <a_samp>
#include <dINI>

#pragma unused strtok
#pragma tabsize 0

new mname[MAX_PLAYER_NAME];
new File[128];

public OnFilterScriptInit() {
	printf("========================");
	printf(" m_Saving System Loaded ");
	printf("========================");
	return true; }

public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, mname, sizeof(mname)); 
    format(File, sizeof(File),"/mUsers/%s.ini",mname);
    if(dini_Exists(File))
	{
        SetPlayerScore(playerid, dini_Int(File, "Score"));
    } else {
        dini_Create(File);
        dini_IntSet(File, "Score", 0);
        SetPlayerScore(playerid, dini_Int(File, "Score"));
		}
    return true;
}

public OnPlayerDisconnect(playerid)
{
    if(dini_Exists(File))
	{
        dini_IntSet(File, "Score", GetPlayerScore(playerid));
    }
}

stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];

while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)