22.09.2016, 11:44
Hey guys, I'm trying to create a system so that every 3 hours a player is in game they get 1 score. For example say if a player played 24 hours their score would be 8. I'm having trouble working out the equation that calculates the score.
Here is what I have.
Here is what I have.
PHP код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || LoggedIn[i] != 1) continue;
new string[128], h, m, s;
TotalGameTime(i,h,m,s);
if(playedTime[i] == 3)
{
PlayerInfo[i][Score] = PlayerInfo[i][Score] +1;
SetPlayerScore(i, PlayerInfo[i][Score]);
GameTextForPlayer(i, "~w~+$1000", 8000, 3);
GivePlayerMoney(i,1000);
format(string,sizeof(string), "You have leveled up! Your new level is %d.", PlayerInfo[i][Score]);
SendClientMessage(i, COLOR_WHITE, string);
}
}
TotalGameTime(playerid, &h=0, &m=0, &s=0)
{
PlayerInfo[playerid][TotalTime] = ( (gettime() - gPlayerJoin[playerid]) + (PlayerInfo[playerid][TotalTime]) );
new p;
p = floatround(PlayerInfo[playerid][TotalTime] / 10800, floatround_floor);
h = floatround(PlayerInfo[playerid][TotalTime] / 3600, floatround_floor);
m = floatround(PlayerInfo[playerid][TotalTime] / 60, floatround_floor) % 60;
s = floatround(PlayerInfo[playerid][TotalTime] % 60, floatround_floor);
playedTime[playerid] = p;
return PlayerInfo[playerid][TotalTime];
}