08.07.2012, 08:12
I have a timer which checks if a player is in current place for current mode of game, but sometimes this timer stops working. What can it be?
pawn Код:
forward dmcheck();
forward dmcheck2(playerid);
#define SetPlayerTimerI(%0,%1,%2) SetTimerEx(%0,%1,%2,"i",i)
public OnGameModeInit()
{
SetTimer("dmcheck",1000,true);
}
public dmcheck()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(mission[i]> 0)
{
if(!IsPlayerInRangeOfPoint(i, 500.0, -1339.1575,1302.2576,1.6600))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 1)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, 1129.0205,-1454.4484,15.7969))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 2)
{
if(!IsPlayerInRangeOfPoint(i, 300.0, 2508.3787,2786.6370,10.8203))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 3)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, -926.4914,-498.8946,25.9609))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 4)
{
if(!IsPlayerInRangeOfPoint(i, 350.0, -2129.3096,-444.2732,35.5344))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 5)
{
if(!IsPlayerInRangeOfPoint(i, 300.0, 214.5838,1875.3218,17.6406))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 6)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, 2275.7498,1072.6093,10.8203))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 7)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, 2257.3013,1086.0162,33.5284))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 8)
{
if(!IsPlayerInRangeOfPoint(i, 200.0, -1465.3469,385.0039,30.0859))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 9)
{
if(!IsPlayerInRangeOfPoint(i, 300.0, -1600.6583,146.1976,-11.1581))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 10)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, 264.6115,2901.8877,8.0913))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 11)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, -919.1942,2680.9565,42.3703))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 12)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, -1291.3860,2505.5720,87.0033))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 13)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, 246.3545,1830.1222,7.5547))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 14)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, -2431.8721,1549.3807,34.4020))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 15)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, -824.7352,2758.3174,45.8516))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 16)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, -537.3676,2627.1506,53.4141))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 17)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, 763.0002,10.5178,1001.1639))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 18)
{
if(!IsPlayerInRangeOfPoint(i, 300.0, -1129.2668,1036.4310,1345.7198))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(dm[i] == 19)
{
if(!IsPlayerInRangeOfPoint(i, 300.0, 761.4807,1062.5439,30.4844))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if (CallRemoteFunction("GetPlayerRaceStatus", "d", i) == 1||CallRemoteFunction("GetPlayerRaceStatus", "d", i) == 2||CallRemoteFunction("GetPlayerRaceStatus", "d", i) == 3)
{
if(!IsPlayerInRangeOfPoint(i, 100.0, 1319.0,-2450.0,23.0))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
if(isafk[i] == 1)
{
if(!IsPlayerInRangeOfPoint(i, 50.0, xafk[i],yafk[i],zafk[i]))
{
SetPlayerTimerI("dmcheck2",3000,false);
}
}
}
}
public dmcheck2(playerid)
{
if(mission[playerid]> 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 500.0, -1339.1575,1302.2576,1.6600))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 1)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 1129.0205,-1454.4484,15.7969))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 2)
{
if(!IsPlayerInRangeOfPoint(playerid, 300.0, 2508.3787,2786.6370,10.8203))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 3)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, -926.4914,-498.8946,25.9609))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 4)
{
if(!IsPlayerInRangeOfPoint(playerid, 350.0, -2129.3096,-444.2732,35.5344))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 5)
{
if(!IsPlayerInRangeOfPoint(playerid, 300.0, 214.5838,1875.3218,17.6406))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 6)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 2275.7498,1072.6093,10.8203))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 7)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 2257.3013,1086.0162,33.5284))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 8)
{
if(!IsPlayerInRangeOfPoint(playerid, 200.0, -1465.3469,385.0039,30.0859))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 9)
{
if(!IsPlayerInRangeOfPoint(playerid, 300.0, -1600.6583,146.1976,-11.1581))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 10)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 264.6115,2901.8877,8.0913))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 11)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, -919.1942,2680.9565,42.3703))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 12)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, -1291.3860,2505.5720,87.0033))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 13)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 246.3545,1830.1222,7.5547))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 14)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, -2431.8721,1549.3807,34.4020))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 15)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, -824.7352,2758.3174,45.8516))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 16)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, -537.3676,2627.1506,53.4141))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 17)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 763.0002,10.5178,1001.1639))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 18)
{
if(!IsPlayerInRangeOfPoint(playerid, 300.0, -1129.2668,1036.4310,1345.7198))
{
SetPlayerToFreeroam(playerid);
}
}
if(dm[playerid] == 19)
{
if(!IsPlayerInRangeOfPoint(playerid, 300.0, 761.4807,1062.5439,30.4844))
{
SetPlayerToFreeroam(playerid);
}
}
if (CallRemoteFunction("GetPlayerRaceStatus", "d", playerid) == 1||CallRemoteFunction("GetPlayerRaceStatus", "d", playerid) == 2||CallRemoteFunction("GetPlayerRaceStatus", "d", playerid) == 3)
{
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 1319.0,-2450.0,23.0))
{
SetPlayerToFreeroam(playerid);
}
}
if(isafk[playerid] == 1)
{
if(!IsPlayerInRangeOfPoint(playerid, 50.0, xafk[playerid],yafk[playerid],zafk[playerid]))
{
CallLocalFunction( "OnPlayerCommandText", "ds", playerid,"/safk");
}
}
}