Stats is not saving.
#1

Why this stats "AdminName" is not saving? There should be an AdminName <name> is user files. why theres not? I added the

OnPlayerOfflineLogin, OnPlayerLogin,, etc i added the vars.

Can anyone please help me?
Reply
#2

Show me the areas where you're saving this please!
Reply
#3

Quote:
Originally Posted by Dokins
Посмотреть сообщение
Show me the areas where you're saving this please!
OnPlayerLogin
Код:
public OnPlayerLogin(playerid,password[])
{
	new string[128];
	new tmp2[256];
	new string2[128];
	new playername2[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername2, sizeof(playername2));
	format(string2, sizeof(string2), "users/%s.ini", playername2);
	new File: UserFile = fopen(string2, io_read);
	if ( UserFile )
	{
		new PassData[256];
		new keytmp[256], valtmp[256];
		fread( UserFile , PassData , sizeof( PassData ) );
		keytmp = ini_GetKey( PassData );
		if( strcmp( keytmp , "Key" , true ) == 0 )
		{
			valtmp = ini_GetValue( PassData );
			strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
		}
		if( strfind( PlayerInfo[playerid][pKey], "\r", true) != -1)
		{
			format(string, sizeof(string), "Warning: \\r found in player %s's password.  Removing now. Password Before: %s", GetPlayerNameEx(playerid), PlayerInfo[playerid][pKey]);
			Log("logs/password.log", string);
			new pos = strfind( PlayerInfo[playerid][pKey], "\r", true);
			strdel(PlayerInfo[playerid][pKey], pos, pos+2);
			format(string, sizeof(string), "%s's Password After: %s  (Note these passwords are encrypted)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pKey]);
			Log("logs/password.log", string);
		}
		//if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
		if(strcmp(PlayerInfo[playerid][pKey],password,true) == 0)
		{
			new key[ 256 ] , val[ 256 ];
			new Data[ 256 ];
			while ( fread( UserFile , Data , sizeof( Data ) ) )
			{
				key = ini_GetKey( Data );
				if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
				if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
				if(strcmp(key, "AdminName", true) == 0) { val = Ini_Value(Data); strmid(PlayerInfo[playerid][pAdminName], val, 0, strlen(val)-1, 255); }
'

OnPlayerOfflineLogin
Код:
public OnPlayerOfflineLogin(playername[])
{
	new string2[64];
	format(string2, sizeof(string2), "users/%s.ini", playername);
	new File: UserFile = fopen(string2, io_read);
	//printf("[DEBUG] OnPlayerOfflineLogin: string2 (%s) | MAX_PLAYERS (%d)", string2, MAX_PLAYERS);
	if ( UserFile )
	{
		//print("[DEBUG] OnPlayerOfflineLogin: UserFile exists, the handle parsed.");
		new key[ 256 ] , val[ 256 ];
		new Data[ 256 ];
		//print("[DEBUG] Starting while ( fread( UserFile , Data , sizeof( Data ) ) )");
		while ( fread( UserFile , Data , sizeof( Data ) ) )
		{
			key = ini_GetKey( Data );
			if( strcmp( key , "Key" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[MAX_PLAYERS][pKey], val, 0, strlen(val)-1, 255); }
			if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[MAX_PLAYERS][pLevel] = strval( val );  }
			if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[MAX_PLAYERS][pAdmin] = strval( val ); }
			if(strcmp(key, "AdminName", true) == 0) { val = Ini_Value(Data); strmid(PlayerInfo[MAX_PLAYERS][pAdminName], val, 0, strlen(val)-1, 255); }
OnPlayerStatsUpdate
Код:
public OnPlayerStatsUpdate(playerid)
{
	if(GetPVarInt(playerid, "TempName") == 1) return 1;
	if(IsPlayerConnected(playerid))
	{
		if(gPlayerLogged{playerid})
		{
			new string3[32];
			new playername3[MAX_PLAYER_NAME];
			GetPlayerName(playerid, playername3, sizeof(playername3));
			format(string3, sizeof(string3), "users/%s.ini", playername3);
			new File: hFile = fopen(string3, io_write);
			if (hFile)
			{
				new var[156];
				format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
				format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
				format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
				format(var, 32, "AdminName=%s\n", PlayerInfo[playerid][pAdminName]);fwrite(hFile, var);
Код:
public OnPlayerRegister(playerid, password[])
{
	if(IsPlayerConnected(playerid))
	{
		new string3[32];
		new playername3[MAX_PLAYER_NAME];
		GetPlayerName(playerid, playername3, sizeof(playername3));
		format(string3, sizeof(string3), "users/%s.ini", playername3);
		new File: hFile = fopen(string3, io_write);
		if (hFile)
		{
			strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
			new var[156];
			format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
			format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
			format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
			format(var, 32, "AdminName=%s\n", PlayerInfo[playerid][pAdminName]);fwrite(hFile, var);
Reply
#4

I've never used any of this before, but what does this do? This is the only inconsistency I can find:
pawn Код:
val = Ini_Value(Data);
Why is this different from this when it's trying to do the same thing?

pawn Код:
ini_GetValue( Data );
pawn Код:
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[MAX_PLAYERS][pAdmin] = strval( val ); }
            if(strcmp(key, "AdminName", true) == 0) { val = Ini_Value(Data); strmid(PlayerInfo[MAX_PLAYERS][pAdminName], val, 0, strlen(val)-1, 255); }
Reply
#5

Quote:
Originally Posted by Dokins
Посмотреть сообщение
I've never used any of this before, but what does this do? This is the only inconsistency I can find:
pawn Код:
val = Ini_Value(Data);
Why is this different from this when it's trying to do the same thing?

pawn Код:
ini_GetValue( Data );
pawn Код:
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[MAX_PLAYERS][pAdmin] = strval( val ); }
            if(strcmp(key, "AdminName", true) == 0) { val = Ini_Value(Data); strmid(PlayerInfo[MAX_PLAYERS][pAdminName], val, 0, strlen(val)-1, 255); }
Because i just copied those into my old script (lol) i dont event know how to script that things which is saving system. really difficult coz im 12 years old
Reply
#6

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)