Timer does not working. +Rep -
Since I started the server, everything's working perfect. After 30-40 minutes then the timer goes off.
And everything that needs to get called by Timer is stopped.
I don't know how it happened and I tried many times to fix it as well.
Код:
public OnGameModeInit()
{
.......something
/* --- Starting permanent Timers --- */
SetTimer("UpdateCmdFreq",2000,1);
SetTimer("UpdateTimeAndDate", 3 * 1000, true); // MDC TIMER 1
SetTimer("OneSecondTimer", 1000, true);
SetTimer("OneMinuteTimer", 60000, true);
SetTimer("OneHourTimer", 3600000, true);
//SetTimer("ThirtyMinuteTimer", 1800000, true);
SetTimer("FiveSecondTimer", 5000, true);//
....... something
return 1;
}
public UpdateCmdFreq()
{
for(new playerid;playerid<MAX_PLAYERS;playerid++)
{
if(PlayerCmdFrq[playerid] > 0)
{
PlayerCmdFrq[playerid]--;
}
}
}
forward UpdateTimeAndDate();
public UpdateTimeAndDate()
{
gettime(hour1, minute1);
format(timestr, sizeof(timestr), "%02d:%02d", hour1, minute1);
TextDrawSetString(MDC[11], timestr);
getdate(year1, month1, day1);
format(datestr, sizeof(datestr), "%02d/%02d/%04d", day1, month1, year1);
TextDrawSetString(MDC[10], datestr);
//if(!Lotteryavailable && hour1 == 19) Lotterystart();
//if(Lotteryavailable && hour1 == 20) Lotteryend();
}
forward OneSecondTimer();
public OneSecondTimer() {
new model,
vehicle;
if(trainCount < 300) {
trainCount++;
} else {
trainCount = 0;
foreach(new t : Player) {
vehicle = GetPlayerVehicleID(t),
model = GetVehicleModel(vehicle);
if(vehicle == trainID && (model == 537 || model == 538 || model == 569 || model == 570 || model == 590)) {
SendClientMessage(t, COLOR_PINK, "* A train conductor passes your seat and asks for your ticket in order to check its validity. (( Train Conductor ))");
if(PlayerInfo[t][pTrainticket] + 86400 < gettime()) {
SendClientMessage(t, COLOR_LIGHTRED, "FINE: You have been fined by a train conductor for driving without a valid train ticket.");
SendClientMessage(t, COLOR_LIGHTRED, "FINE: Your bank account will be charged with an overall amount of $40 on the next payday.");
PlayerInfo[t][pFine] += 40;
}
}
}
}
for(new v = 0; v != MAX_VEHICLES; v++) {
model = GetVehicleModel(v);
if((model == 420 || model == 438) && VehicleInfo[v][vTM] != 0) {
if(GetVehicleSpeed(v) > 0) {
VehicleInfo[v][vTMTime]++;
if(VehicleInfo[v][vTMCounter] == 9) {
VehicleInfo[v][vTMPayment] += GetPVarInt(GetPlayerID(VehicleInfo[v][vOwner]), "taxiFare");
VehicleInfo[v][vTMCounter] = 0;
} else {
VehicleInfo[v][vTMCounter]++;
}
}
}
}
new zone[230],
surfVID,
interior;
foreach(new i : Player) {
if(GetPVarInt(i, "TrashmasterUnload") != 0) {
if(IsPlayerInAnyVehicle(i)) {
vehicle = GetPlayerVehicleID(i);
if(GetVehicleModel(vehicle) == 408) {
VehicleInfo[vehicle][vTrashbags]--;
if(VehicleInfo[vehicle][vTrashbags] <= 0) {
PlayerTextDrawSetString(i, TD_JOB_FirstLine, "Trashmaster has been unloaded.");
UnfreezePlayer(i);
SetPlayerTrashCP(i);
SetPVarInt(i, "TrashmasterUnload", 0);
format(zone, sizeof(zone), "There are currently %i/%i trash bags in your Trashmaster.", VehicleInfo[vehicle][vTrashbags], MAX_TRASHMASTER);
PlayerTextDrawSetString(i, TD_JOB_SecondLine, zone);
} else {
if(VehicleInfo[vehicle][vTrashbags] == 1) {
format(zone, sizeof(zone), "Unloading (%i trash bag left) ...", VehicleInfo[vehicle][vTrashbags]);
} else {
format(zone, sizeof(zone), "Unloading (%i trash bags left) ...", VehicleInfo[vehicle][vTrashbags]);
}
PlayerTextDrawSetString(i, TD_JOB_FirstLine, zone);
format(zone, sizeof(zone), "There are currently %i/%i trash bags in your Trashmaster.", VehicleInfo[vehicle][vTrashbags], MAX_TRASHMASTER);
PlayerTextDrawSetString(i, TD_JOB_SecondLine, zone);
}
PlayerTextDrawShow(i, TD_JOB_FirstLine);
} else {
PlayerTextDrawHide(i, TD_JOB_FirstLine);
SetPVarInt(i, "TrashmasterUnload", 0);
}
} else {
PlayerTextDrawHide(i, TD_JOB_FirstLine);
SetPVarInt(i, "TrashmasterUnload", 0);
}
}
/* --- Anti Money Hack --- */
if(GetPVarInt(i, "AntiMoneyHack") == 0 && GetPlayerMoney(i) > PlayerInfo[i][pMoney]) {
new moneyHack[128];
format(moneyHack, sizeof(moneyHack), "*** Hack Warning: %s (ID: %i) is presumably money hacking (Client-side: $%i, Server-side: $%i).", GetNameWithSpace(i), i, GetPlayerMoney(i), PlayerInfo[i][pMoney]);
//AdminMessageLog(moneyHack, i, "HACK WARNING - Money");
SetPVarInt(i, "AntiMoneyHack", 1);
AntiMoneyHackTimerVar[i] = SetTimerEx("AntiMoneyHackTimer", 60000, false, "i", i);
}
/* --- Anti Armour Hack --- */
if(GetPVarInt(i, "SettingArmour") == 0) {
new Float:armour;
GetPlayerArmour(i, armour);
if(GetPVarInt(i, "AntiArmourHack") == 0 && armour > GetPVarFloat(i, "Armour")) {
new armourHack[128];
format(armourHack, sizeof(armourHack), "*** Hack Warning: %s (ID: %i) is presumably armour hacking (Armour: %.2f, Expected armour: %.2f).", GetNameWithSpace(i), i, armour, GetPVarFloat(i, "Armour"));
//AdminMessageLog(armourHack, i, "HACK WARNING - Armour");
SetPVarInt(i, "AntiArmourHack", 1);
AntiArmourHackTimerVar[i] = SetTimerEx("AntiArmourHackTimer", 60000, false, "i", i);
}
}
/* --- Anti Health Hack --- */
if(GetPVarInt(i, "SettingHealth") == 0) {
new Float:health;
GetPlayerHealth(i, health);
if(GetPVarInt(i, "AntiHealthHack") == 0 && health > GetPVarFloat(i, "Health")) {
new healthHack[128];
format(healthHack, sizeof(healthHack), "*** Hack Warning: %s (ID: %i) is presumably health hacking (Health: %.2f, Expected health: %.2f).", GetNameWithSpace(i), i, health, GetPVarInt(i, "Health"));
//AdminMessageLog(healthHack, i, "HACK WARNING - Health");
SetPVarInt(i, "AntiHealthHack", 1);
AntiHealthHackTimerVar[i] = SetTimerEx("AntiHealthHackTimer", 60000, false, "i", i);
}
}
/* --- Anti Weapon Hack --- */
new wepCheck;
if(GetPVarInt(i, "AntiWeaponHack") == 0)
{
new slot[2];
for(new w = 0; w != 13; w++)
{
GetPlayerWeaponData(i, w, slot[0], slot[1]);
if(slot[1] != 0 && (slot[0] >= sizeof(WeaponData) || (slot[0] != 0 && (WeaponData[slot[0]][itemType] != PlayerInfo[i][pItemType][0] || items[WeaponData[slot[0]][itemType]][itemType] != ITEM_WEAPON))))
{
if(wepCheck == 0 && slot[0] == 23 && PlayerInfo[i][pItemType][0] == 242)
{
wepCheck = 1;
}
else
{
new msg[150],
wName[30];
if(PlayerInfo[i][pItemType][0] == 253 || PlayerInfo[i][pItemType][0] == 254 || PlayerInfo[i][pItemType][0] == 255 || PlayerInfo[i][pItemType][0] == 219 || PlayerInfo[i][pItemType][0] == 221 ||
PlayerInfo[i][pItemType][0] == 222 || PlayerInfo[i][pItemType][0] == 220 || PlayerInfo[i][pItemType][0] == 218 || PlayerInfo[i][pItemType][0] == 223 || PlayerInfo[i][pItemType][0] == 211 ||
PlayerInfo[i][pItemType][0] == 206 || PlayerInfo[i][pItemType][0] == 30 || PlayerInfo[i][pItemType][0] == 213 || PlayerInfo[i][pItemType][0] == 225)
{
}
else
{
GetWeaponName(slot[0], wName, sizeof(wName));
format(msg, sizeof(msg), "*** Hack Warning: %s (ID: %i) is presumably weapon hacking(Weapon: %s, Ammo: %i).", GetNameWithSpace(i), i, wName, slot[1]);
AdminMessageLog(msg, i, "HACK WARNING - Weapon");
SetPVarInt(i, "AntiWeaponHack", 1);
AntiWeaponHackTimerVar[i] = SetTimerEx("AntiWeaponHackTimer", 60000, false, "i", i);
break;
}
}
}
}
}
if(GetPVarInt(i, "LoadData") != 0)
{
if(GetPVarInt(i, "ClothingStoreActive") == 0 && GetPVarInt(i, "WardrobeActive") == 0 && GetPVarInt(i, "PayNSpray") == 0 && GetPVarInt(i, "InModGarage") == 0 &&
GetPVarInt(i, "DealershipLoc") == 0)
{
interior = GetPlayerInterior(i);
if(GetPVarInt(i, "MapInfoHide") == 0) {
if(GetPVarInt(i, "InBusiness") != 0) {
PlayerTextDrawSetString(i, TD_Zone, "Business");
} else if(GetPVarInt(i, "InHouse") != 0) {
PlayerTextDrawSetString(i, TD_Zone, "House");
} else if(interior != 0) {
PlayerTextDrawSetString(i, TD_Zone, "Interior");
} else {
if(GetPlayer2DZone(i, zone, 30) != 0) {
PlayerTextDrawSetString(i, TD_Zone, zone);
} else {
PlayerTextDrawSetString(i, TD_Zone, "Unknown");
}
}
PlayerTextDrawShow(i, TD_Zone);
} else {
PlayerTextDrawHide(i, TD_Zone);
}
} else {
PlayerTextDrawHide(i, TD_Zone);
SetPlayerWeather(i, 0);
}
}
if(PlayerInfo[i][pBoombox] == -1) {
if(!IsPlayerInAnyVehicle(i) || (VehicleInfo[GetPlayerVehicleID(i)][vWindows] != 0 && isnull(VehicleInfo[GetPlayerVehicleID(i)][vRadio]))) {
if(GetPVarInt(i, "InHouse") == 0 || isnull(HouseInfo[GetPlayerVirtualWorld(i)][hRadio])) {
if(GetPVarInt(i, "InBusiness") == 0 || isnull(BusinessInfo[GetPlayerVirtualWorld(i)][bRadio])) {
foreach(new boom : iter_boomboxes) {
if(!isnull(boomboxes[boom][boomRadio]) && IsPlayerInRangeOfPoint(i, 20, boomboxes[boom][boomX], boomboxes[boom][boomY], boomboxes[boom][boomZ])) {
PlayerInfo[i][pBoombox] = boom;
PlayAudioStreamForPlayer(i, boomboxes[boom][boomRadio], boomboxes[boom][boomX], boomboxes[boom][boomY], boomboxes[boom][boomZ], 35.0, 1);
break;
}
}
}
}
}
} else {
if(!IsPlayerInRangeOfPoint(i, 20, boomboxes[PlayerInfo[i][pBoombox]][boomX], boomboxes[PlayerInfo[i][pBoombox]][boomY], boomboxes[PlayerInfo[i][pBoombox]][boomZ])) {
PlayerInfo[i][pBoombox] = -1;
StopAudioStreamForPlayer(i);
}
}
if(GetPVarInt(i, "PayNSpray") != 0) {
vehicle = GetPVarInt(i, "PayNSprayTime") - 1;
if(vehicle % 60 > 9) {
format(zone, sizeof(zone), "%i:%i", vehicle / 60, vehicle % 60);
} else {
format(zone, sizeof(zone), "%i:0%i", vehicle / 60, vehicle % 60);
}
PlayerTextDrawSetString(i, TD_P_TimeValue, zone);
SetPVarInt(i, "PayNSprayTime", vehicle);
if(vehicle == 0) {
switch(GetPVarInt(i, "PayNSpray")) {
case 1: {
SetPlayerPosEx(i, 14, 2076.4214, -1838.0778, 13.1692, 179.4030);
}
case 2: {
SetPlayerPosEx(i, 14, 717.2195, -472.7567, 16.0488, 179.5338);
}
case 3: {
SetPlayerPosEx(i, 14, 1014.5531, -1033.7996, 31.2687, 89.7582);
}
case 4: {
SetPlayerPosEx(i, 14, 481.7528, -1730.1110, 10.7038, 82.9610);
}
default: {
SetPlayerPosEx(i, 14, 2076.4214, -1838.0778, 13.1692, 179.4030);
}
}
}
}
/*surfVID = GetPlayerSurfingVehicleID(i);
if(surfVID != INVALID_VEHICLE_ID && GetVehicleSpeed(surfVID) > 50 && surfVID != surfVehicles[i] && IsSurfableVehicle(GetVehicleModel(surfVID)) == 0) {
new Float:ran = frandom(2.0, -2.0),
Float:X,
Float:Y,
Float:Z,
Float:velX,
Float:velY,
Float:velZ;
if(GetPVarInt(i, "AntiSurf") == 0) {
format(zone, sizeof(zone), "** %s loses %s balance and rolls off the vehicle.", GetNameWithSpace(i, 1), HisHer(i));
ProxDetector(12, i, zone, COLOR_PINK);
}
GetVehiclePos(surfVID, X, Y, Z);
GetVehicleVelocity(surfVID, velX, velY, velZ);
if(velX > velY) {
SetPlayerPos(i, X + ran, Y + 1.5 + ran, Z + 0.3);
} else {
SetPlayerPos(i, X + 1.5 + ran, Y + ran, Z + 0.3);
}
surfVehicles[i] = surfVID;
fade[i][fID] = 13;
ApplyAnimation(i, "FINALE", "FIN_Land_Die", 4.1, 0, 1, 1, 1, 1, 1);
FadeScreen(i, 0, 0, 0, 175, 100);
SetPVarInt(i, "AntiSurf", 1);
AntiSurfTimerVar[i] = SetTimerEx("AntiSurfTimer", 3000, false, "i", i);
}*/
if(IsPlayerInAnyVehicle(i)) {
vehicle = GetPlayerVehicleID(i);
surfVID = GetVehicleSpeed(vehicle);
if(surfVID > 198 && GetPVarInt(i, "AntiSpeedHackVehicle") == 0) {
format(zone, sizeof(zone), "*** %s (ID: %i) is possibly speed hacking with a vehicle (Speed: %i km/h).", GetNameWithSpace(i), i, surfVID);
AdminMessageLog(zone, i, "HACK WARNING - Speed");
SetPVarInt(i, "AntiSpeedHackVehicle", 1);
AntiSpeedHackVehicleTimerVar[i] = SetTimerEx("AntiSpeedHackVehicleTimer", 60000, false, "i", i);
}
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && GetPVarInt(i, "InModGarage") == 0) {
if(IsAnEngineCar(vehicle)) {
new Float:health;
if(surfVID > 110 && GetPVarInt(i, "LSPDDuty") == 0 && GetPVarInt(i, "LSFDDuty") == 0 && GetPVarInt(i, "AdminDuty") == 0 &&
GetPVarInt(i, "CameraTimer") == 0 && (IsPlayerInRangeOfPoint(i, 10, 1827.393310, -1600.081787, 11.040195) ||
IsPlayerInRangeOfPoint(i, 10, 1831.478637, -1746.649780, 11.036874) || IsPlayerInRangeOfPoint(i, 10, 1815.969116, -1743.268676, 11.036874) ||
IsPlayerInRangeOfPoint(i, 10, 807.349243, -1389.981933, 11.089693) || IsPlayerInRangeOfPoint(i, 10, 790.897888, -1385.355590, 11.190835) ||
IsPlayerInRangeOfPoint(i, 10, 1212.821166, -1411.753417, 10.855206) || IsPlayerInRangeOfPoint(i, 10, 1376.588134, -1877.384399, 11.046875) ||
IsPlayerInRangeOfPoint(i, 10, 1370.983886, -1865.755981, 11.046875) || IsPlayerInRangeOfPoint(i, 10, 2118.416748, -1676.064697, 11.042663) ||
IsPlayerInRangeOfPoint(i, 10, 2106.844482, -1672.438232, 11.288070) || IsPlayerInRangeOfPoint(i, 10, 2385.395263, -1179.892089, 25.226203) ||
IsPlayerInRangeOfPoint(i, 10, 2385.395263, -1179.892089, 25.226203))) {
mysql_format(sqlHandle, zone, sizeof(zone), "INSERT INTO `samp_tickets` (`user`, `reason`, `charge`, `date`, `timestamp`, `issuer`, `agency`) VALUES ('%e', '%e', %i, NOW(), %i, '%e', '%e')", PlayerInfo[i][pName], "Speeding", (floatround(surfVID) - 110) * 2, gettime(), "Automatic", "Los Angeles Police Department");
mysql_function_query(sqlHandle, zone, false, "OnNewSpeedCameraCitation", "sii", "Speeding", (floatround(surfVID) - 110) * 2, i);
SetPVarInt(i, "CameraTimer", 1);
FadeScreen(i, 255, 255, 185, 100, 100);
CameraTimerVar[i] = SetTimerEx("CameraTimer", 2000, false, "d", i);
}
if(dmvdrive[i] > 0) {
if(surfVID > GetPVarInt(i, "DMVSpeed")) {
SetPVarInt(i, "DMVSpeed", floatround(surfVID));
}
if(surfVID > 80 && GetPVarInt(i, "DMV80Speed") == 0) {
SetPVarInt(i, "DMVStatus", GetPVarInt(i, "DMVStatus")+1);
SetPVarInt(i, "DMV80Speed", 1);
}
if(surfVID > 100) {
SetPVarInt(i, "DMVStatus", 4);
}
}
GetVehicleHealth(vehicle, health);
if(health < GM_BREAKDOWN_HEALTH) {
new breakdownData[7];
VehicleInfo[vehicle][vAvoidUpdate] = 1;
SetVehicleHealth(vehicle, GM_BREAKDOWN_HEALTH - 1);
GetVehicleParamsEx(vehicle, breakdownData[0], breakdownData[1], breakdownData[2], breakdownData[3], breakdownData[4], breakdownData[5], breakdownData[6]);
SetVehicleParamsEx(vehicle, 0, breakdownData[1], breakdownData[2], breakdownData[3], breakdownData[4], breakdownData[5], breakdownData[6]);
if(breakdownData[0] == 1) {
SendClientMessage(i, COLOR_WHITE, "Vehicle engine broke down, you may call a mechanic to repair your vehicle.");
}
}
format(zone, sizeof(zone), "%d KM/H", floatround(surfVID));
PlayerTextDrawHide(i, TD_SM_Speed_Value);
PlayerTextDrawSetString(i, TD_SM_Speed_Value, zone);
PlayerTextDrawShow(i, TD_SM_Speed_Value);
}
}
model = GetVehicleModel(vehicle);
if((model == 420 || model == 438) && VehicleInfo[vehicle][vTM] != 0) {
new time[20],
payment[20],
minutes = floatround(VehicleInfo[vehicle][vTMTime] / 60),
seconds = VehicleInfo[vehicle][vTMTime] - floatround(VehicleInfo[vehicle][vTMTime] / 60) * 60;
format(payment, sizeof(payment), "$%i", VehicleInfo[vehicle][vTMPayment]);
if(seconds >= 10) {
format(time, sizeof(time), "%i:%i", minutes, seconds);
} else {
format(time, sizeof(time), "%i:0%i", minutes, seconds);
}
PlayerTextDrawHide(i, TD_C_TimeValue);
PlayerTextDrawSetString(i, TD_C_TimeValue, time);
PlayerTextDrawHide(i, TD_C_PaymentValue);
PlayerTextDrawSetString(i, TD_C_PaymentValue, payment);
PlayerTextDrawShow(i, TD_C_TimeValue);
PlayerTextDrawShow(i, TD_C_PaymentValue);
}
}
else
{
surfVID = GetPlayerSpeed(i);
if(surfVID > 75 && GetPVarInt(i, "AntiSpeedHackFoot") == 0 && GetPlayerSurfingVehicleID(i) == INVALID_VEHICLE_ID)
{
format(zone, sizeof(zone), "*** %s (ID: %i) is possibly speed hacking on foot (Speed: %i km/h).", GetNameWithSpace(i), i, surfVID);
AdminMessageLog(zone, i, "HACK WARNING - Speed");
SetPVarInt(i, "AntiSpeedHackFoot", 1);
AntiSpeedHackFootTimerVar[i] = SetTimerEx("AntiSpeedHackFootTimer", 60000, false, "i", i);
}
}
/*if(GetPVarInt(i, "taxiRequest") != 0) {
new time = GetPVarInt(i, "taxiRequest");
if(time >= 21) {
new oldTaxiDriver = GetPVarInt(i, "taxiDriver"),
Float:X,
Float:Y, Float:Z,
Float:distance,
taxiDriverID = -1,
vModel;
GetPlayerPos(i, X, Y, Z);
foreach(new t : Player) {
if(Paused[t] == 0 && IsPlayerInAnyVehicle(t) && t != i && t != oldTaxiDriver) {
vehicle = GetPlayerVehicleID(t);
vModel = GetVehicleModel(vehicle);
if((vModel == 420 || vModel == 438) && !isnull(VehicleInfo[vehicle][vOwner]) && strcmp(VehicleInfo[vehicle][vOwner], PlayerInfo[t][pName]) == 0) {
if(taxiDriverID == -1 || GetPlayerDistanceFromPoint(t, X, Y, Z) < distance) {
taxiDriverID = t;
distance = GetPlayerDistanceFromPoint(t, X, Y, Z);
}
}
}
}
if(taxiDriverID != -1) {
TextDrawShowForPlayer(taxiDriverID, TD_T_Box);
TextDrawShowForPlayer(taxiDriverID, TD_T_Headline);
TextDrawShowForPlayer(taxiDriverID, TD_T_HeadBox);
TextDrawShowForPlayer(taxiDriverID, TD_T_Info);
TextDrawShowForPlayer(taxiDriverID, TD_T_Instruction);
SetPVarInt(taxiDriverID, "takecall", i);
SetPVarInt(taxiDriverID, "takecallNumber", GetPVarInt(oldTaxiDriver, "takecallNumber"));
SetPVarInt(i, "taxiDriver", taxiDriverID);
SetPVarInt(i, "taxiRequest", 1);
} else {
SetPVarInt(i, "taxiRequest", 0);
SetPVarInt(i, "taxiDriver", 0);
SendClientMessage(i, COLOR_DARKYELLOW, "[SMS] Taxi Association (544): Unfortunately, we were not able to dispatch any taxi driver to your location. Try again later.");
}
TextDrawHideForPlayer(oldTaxiDriver, TD_T_Box);
TextDrawHideForPlayer(oldTaxiDriver, TD_T_Headline);
TextDrawHideForPlayer(oldTaxiDriver, TD_T_HeadBox);
TextDrawHideForPlayer(oldTaxiDriver, TD_T_Info);
TextDrawHideForPlayer(oldTaxiDriver, TD_T_Instruction);
SetPVarInt(oldTaxiDriver, "takecall", 0);
SetPVarInt(oldTaxiDriver, "takecallNumber", 0);
} else {
SetPVarInt(i, "taxiRequest", time + 1);
}
}*/
if(RecentlyFired[i] != 0)
{
RecentlyFired[i] -= 1;
}
if(DrugTime[i] != 0)
{
if(DrugTime[i] == 1)
{
SetPlayerWeather(i, gWeather);
GameTextForPlayer(i, "Drug Cooldown Over!", 5000, 1);
DrugTime[i] -= 1;
}
else
{
DrugTime[i] -= 1;
}
}
if(WeedTime[i] != 0)
{
WeedTime[i] -= 1;
}
if(CocaineTime[i] != 0)
{
if(CocaineTime[i] == 1)
{
CocaineTime[i] -= 1;
SetPlayerArmour(i, 0.0);
}
else
{
CocaineTime[i] -= 1;
}
}
if(EcstasyTime[i] != 0)
{
EcstasyTime[i] -= 1;
}
if(CrackTime[i] != 0)
{
if(CrackTime[i] == 1)
{
CrackTime[i] -= 1;
SetPlayerDrunkLevel(i, 0);
}
else
{
CrackTime[i] -= 1;
SetPlayerDrunkLevel(i, 200);
}
}
if(HeroinTime[i] != 0)
{
if(HeroinTime[i] == 1)
{
HeroinTime[i] -= 1;
SetPlayerDrunkLevel(i, 0);
}
else
{
HeroinTime[i] -= 1;
SetPlayerDrunkLevel(i, 200);
}
}
if(IsBreakingIn[i] == 1)
{
if(!IsPlayerInRangeOfPoint(i, 3.0, BreakX[i], BreakY[i], BreakZ[i]))
{
KillTimer(BreakInTimer[i]);
IsBreakingIn[i] = 0;
BreakX[i] = 0.0;
BreakY[i] = 0.0;
BreakZ[i] = 0.0;
BreakDownTimer[i] = 0;
IsBreaking[i] = 0;
SendClientMessage(i, COLOR_LIGHTRED, "You have failed to break into this vehicle for exceeding three meters.");
}
}
if(IsBreaking[i] == 1 && BreakDownTimer[i] > 0)
{
if(BreakDownTimer[i] > 0)
{
new string[128];
BreakDownTimer[i] --;
format(string, sizeof(string), "%i", BreakDownTimer[i]);
GameTextForPlayer(i, string, 1000, 6);
}
else
{
BreakDownTimer[i] = 0;
}
}
if(PlayerInfo[i][pPayTimer] < 1500 && PlayerInfo[i][pHadPayday] == 1)
{
PlayerInfo[i][pHadPayday] = 0;
}
if(GetPVarInt(i, "LoadData") != 0) {
if(PlayerInfo[i][pPayTimer] < GM_MIN_TIME_PAYCHECK){
if(Paused[i] == 0 && IdleInfo[i][idleMode] == 0) {
PlayerInfo[i][pPayTimer]++;
}
} else {
payday(i);
}
if(Paused[i] == 0 && gettime() - LastUpdate[i] > 5) {
Paused[i] = 1;
afkCounter[i] = 5;
} else if(Paused[i] != 0) {
afkCounter[i]++;
}
}
}
}
forward OneMinuteTimer();
public OneMinuteTimer()
{
for(new weed = 0; weed < sizeof(WeedInfo); weed++)
{
if(WeedInfo[weed][weedPlanted] == 1 && WeedInfo[weed][weedTime] > 0)
{
WeedInfo[weed][weedTime]--;
}
}
for(new opium = 0; opium < sizeof(OpiumInfo); opium++)
{
if(OpiumInfo[opium][opiumPlanted] == 1 && OpiumInfo[opium][opiumTime] > 0)
{
OpiumInfo[opium][opiumTime]--;
}
}
foreach(new i : Player)
{
if(GetPVarInt(i, "Login") == 1)
{
new arrest = GetPVarInt(i, "Arrest"),
prison = PlayerInfo[i][pPrisonTime],
Float:X,
Float:Y,
Float:Z;
if(arrest > 0)
{
SetPVarInt(i, "Arrest", arrest - 1);
}
else if(GetPVarInt(i, "Arrested") != 0 && arrest <= 0)
{
SetPlayerPosEx(i, 5, 1542.3568, -1675.1830, 13.5543);
SetPVarInt(i, "Arrest", 0);
SetPVarInt(i, "Arrested", 0);
}
if(prison > 0)
{
PlayerInfo[i][pPrisonTime] = prison - 1;
}
if(PlayerInfo[i][pPrisoned] == 1 && PlayerInfo[i][pPrisonTime] < 1)
{
SetPlayerPos(i, 298.1048,1406.8234,9.6768);
PlayerInfo[i][pPrisoned] = 0;
PlayerInfo[i][pPrisonTime] = 0;
}
if(PlayerInfo[i][pSwatCooldown] > 0)
{
PlayerInfo[i][pSwatCooldown] --;
}
GetPlayerPos(i, X, Y, Z);
IdleInfo[i][minCounter]++;
if(IdleInfo[i][unset] != 0) {
IdleInfo[i][idleX] = X;
IdleInfo[i][idleY] = Y;
IdleInfo[i][idleZ] = Z;
IdleInfo[i][minCounter] = 0;
IdleInfo[i][idleMode] = 0;
IdleInfo[i][unset] = 0;
} else if(IdleInfo[i][idleX] != X || IdleInfo[i][idleY] != Y || IdleInfo[i][idleZ] != Z) {
IdleInfo[i][idleX] = X;
IdleInfo[i][idleY] = Y;
IdleInfo[i][idleZ] = Z;
IdleInfo[i][minCounter] = 0;
IdleInfo[i][unset] = 0;
if(IdleInfo[i][idleMode] != 0) {
IdleInfo[i][idleMode] = 0;
}
} else if(IdleInfo[i][idleX] == X && IdleInfo[i][idleY] == Y && IdleInfo[i][idleZ] == Z && IdleInfo[i][minCounter] == 5) {
IdleInfo[i][idleMode] = 1;
}
JumpCounter[i] = 0;
}
}
}
forward OneHourTimer();
public OneHourTimer() {
new Hour,
Minute,
Second;
DeleteUnownedItems();
gWeather = random(20);
gettime(Hour, Minute, Second);
SetWeather(gWeather);
SetWorldTime(Hour);
foreach(new i : Player)
{
if(GetPVarInt(i, "AdminJailed") != 0)
{
SetPlayerTime(i, 12, 0);
}
else if(GetPVarInt(i, "InModGarage") != 0)
{
SetPlayerWeather(i, 2);
}
else
{
SetPlayerTime(i, Hour, Minute);
}
if(AddictionCheck[i] != 0)
{
AddictionCheck[i] = 0;
}
}
}
forward FiveSecondTimer();
public FiveSecondTimer() {
foreach(new p : Player) {
SetPVarInt(p, "Reload", 0);
SetPVarInt(p, "DrinkingSpamBlocker", 0);
}
for(new i = 0; i != MAX_CALLS; i++) {
if(IncomingCalls[i][cCaller] != -1) {
if(IncomingCalls[i][cFail] != 0) {
new me[95];
switch(IncomingCalls[i][cFail]) {
case 1: {
SendClientMessage(IncomingCalls[i][cCaller], COLOR_GREY, "The number you are currently calling is not in service.");
}
case 2: {
SendClientMessage(IncomingCalls[i][cCaller], COLOR_GREY, "The number you are currently calling is temporarily not available.");
}
}
if(PlayerInfo[IncomingCalls[i][cCaller]][pItemVar][0] != IncomingCalls[i][cCallingNumber]) {
RemovePlayerAttachedObject(IncomingCalls[i][cCaller], IDX_CELLPHONE);
format(me, sizeof(me), "** %s hangs up %s current phone call and pockets %s cellphone.", GetNameWithSpace(IncomingCalls[i][cCaller], 1), HisHer(IncomingCalls[i][cCaller]), HisHer(IncomingCalls[i][cCaller]));
} else {
format(me, sizeof(me), "** %s hangs up %s current phone call.", GetNameWithSpace(IncomingCalls[i][cCaller], 1), HisHer(IncomingCalls[i][cCaller]));
}
SetPVarInt(IncomingCalls[i][cCaller], "Calling", -1);
SetPVarInt(IncomingCalls[i][cCaller], "UseCellphone", 0);
SetPVarInt(IncomingCalls[i][cCaller], "CallingNumber", 0);
SetPVarInt(IncomingCalls[i][cCaller], "PhoneStep", 0);
SetPVarInt(IncomingCalls[i][cCaller], "CallingSpeaker", 0);
SetPlayerSpecialAction(IncomingCalls[i][cCaller], SPECIAL_ACTION_STOPUSECELLPHONE);
UnsetIncomingCall(i);
} else if(IncomingCalls[i][cCalled] != -1) {
new me[50],
msg[75];
format(me, sizeof(me), "** %s's cellphone rings.", GetNameWithSpace(IncomingCalls[i][cCalled], 1));
ProxDetector(12, IncomingCalls[i][cCalled], me, COLOR_PINK, 1, 20804);
format(msg, sizeof(msg), "You may use /pickup in order to accept the incoming call from '%i'.", IncomingCalls[i][cCallingNumber]);
SendClientMessage(IncomingCalls[i][cCalled], COLOR_WHITE, msg);
} else if(IncomingCalls[i][cCalledNumber] == HOTLINE_EMERGENCY) {
SetPVarInt(IncomingCalls[i][cCaller], "Calling", HOTLINE_EMERGENCY);
SetPVarInt(IncomingCalls[i][cCaller], "PhoneStep", 1);
SendClientMessage(IncomingCalls[i][cCaller], COLOR_DARKYELLOW, "Dispatch says: (cellphone) 911 Emergency-Center, do you require the 'Police Department', 'Fire Department' or 'Both'?");
UnsetIncomingCall(i);
} else if(IncomingCalls[i][cCalledNumber] == HOTLINE_TAXI) {
SetPVarInt(IncomingCalls[i][cCaller], "Calling", HOTLINE_TAXI);
SendClientMessage(IncomingCalls[i][cCaller], COLOR_DARKYELLOW, "Employee says: (cellphone) Los Angeles Taxi Association, what is your current location?");
UnsetIncomingCall(i);
} else if(IncomingCalls[i][cCalledNumber] == HOTLINE_MECHANIC) {
SetPVarInt(IncomingCalls[i][cCaller], "Calling", HOTLINE_MECHANIC);
SendClientMessage(IncomingCalls[i][cCaller], COLOR_DARKYELLOW, "Employee says: (cellphone) Los Angeles Mechanic Association, what is your current location?");
UnsetIncomingCall(i);
}
}
}
}
Re: Timer does not working. -
Re: Timer does not working. -
Re: Timer does not working. -