Playtime BUG
#1

Hello i have a Bug with my Playtime only ID 0 becomes the playtime and when a player have id 0 saves the complete playtime how can i fix this bug?

here the timer scripts:


Код:
enum gPlayerInfo
{
	minutesPlayed,
	hoursPlayed,
	Onlinetimer
};
Код:
	if(response)
	{
 			if(rows > 0)
           {
               if(mysql_fetch_row(line))
               {
                    new savingstring[20];
                   	new data[3][55];
         			new data2[5];
          			sscanf(line, "p<|>s[50]s[300]dddds[50]ds[100]", data[0], largestring, data2[0], data2[1], data2[2], data2[3], data[2], data2[4], estring);
			   		stringempty(estring);
			   		stringempty(largestring);
      				SetPVarInt(playerid, "Logged", 1);
					mysql_fetch_field_row(savingstring, "hoursplayed"); PlayerInfo[playerid][hoursPlayed] = strval(savingstring);
        			mysql_fetch_field_row(savingstring, "minutesplayed"); PlayerInfo[playerid][minutesPlayed] = strval(savingstring);
                   	SendClientMessage(playerid, COLOR_YELLOW, "* Erfolgreich Eingeloggt!");
                   	mysql_free_result();
                   	PlayerInfo[playerid][Onlinetimer] = SetTimerEx("CheckHMPlayed", 60000, 1, "i", playerid);
                   	GetPlayerIp(playerid, PIP, 18);
                   	format(Query, sizeof(Query), "UPDATE `playerinfo` SET IP = '%s' WHERE user='%s'", PIP, escpname(playerid));
				    mysql_query(Query);
			   		}
		   		}
       		}
    }
    return 1;
}
stock GetPlayerHours(playerid) return PlayerInfo[playerid][hoursPlayed];
stock GetPlayerMinutes(playerid) return PlayerInfo[playerid][minutesPlayed];
Код:
public CheckHMPlayed(playerid)
{
	PlayerInfo[playerid][minutesPlayed]++;
	if(PlayerInfo[playerid][minutesPlayed] == 60)
	{
		PlayerInfo[playerid][hoursPlayed]++;
		PlayerInfo[playerid][minutesPlayed] = 0;
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)