Код:
public globalPlayerLoop() {
pingTick++;
if(pingTick >= 120) {
if(mysql_ping() == -1) {
mysql_reconnect(); // After 120 seconds (2 minutes), we need to ensure the connection is still alive. MySQL sometimes plays up and forces the connection to timeout.
}
pingTick = 0;
}
if(adTick >= 1)
adTick--;
/* --------------------- WORLD TIME --------------------- */
gettime(gTime[0], gTime[1], gTime[2]);
if(gTime[1] >= 59 && gTime[2] >= 59) {
weatherVariables[1] += random(3) + 1; // Weather changes aren't regular.
//SetWorldTime(gTime[0]); // Set the world time to keep the worldtime variable updated (and ensure it syncs instantly for connecting players).
if(weatherVariables[1] >= MAX_WEATHER_POINTS) {
weatherVariables[0] = validWeatherIDs[random(sizeof(validWeatherIDs))];
foreach(Player, i) {
if(!GetPlayerInterior(i)) {
SetPlayerWeather(i, weatherVariables[0]);
}
else SetPlayerWeather(i, INTERIOR_WEATHER_ID);
}
weatherVariables[1] = 0;
}
}
foreach(Player, x)
{
PlayerInfo[x][pConnectedSeconds] += 1;
if(gTime[2] >= 59) syncPlayerTime(x);
if(PlayerInfo[x][pStatus] == 1) {
if(IsPlayerESC[x] <= 0)
{
IsPlayerESC[x] = 0;
Esctime[x] += 1;
format(szMessage, sizeof(szMessage), "*ЛВШґЄСиЗ¤ГТЗ* (%d ЗФ№Т·Х)", Esctime[x]);
SetPlayerChatBubble(x,szMessage,0x6E6E6EFF,30.0,1500);
}
IsPlayerESC[x]--;
PlayerInfo[x][pSeconds]++;
// Fuel
new vehicleid = GetPlayerVehicleID(x);
if(GetPlayerState(x) == PLAYER_STATE_DRIVER && Fuel[vehicleid] <= 0)
{
if(Bicycle(vehicleid)) return 1;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine)
{
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
format(szMessage, sizeof(szMessage), "* ѕТЛ№РўН§ %s ЛВШґЕ§а№ЧиН§ЁТЎдБиБХЎкТ«аЛЕЧНАТВг№¶С§", RPN(x));
nearByMessage(x, COLOR_PURPLE, szMessage);
}
}
It will increase pSeconds for a player only if the pStatus is 1.
By the way, update foreach. The syntax (for the new version) is: