So, you can see that it is spammed very fastly, 4-5 times per second, and I think that it gets lag to the server, sometimes crash too .
I tried to use the " if(i != INVALID_PLAYER_ID) " function , but it is still so .
Код:
public OtherTimer()
{
//new Float:maxspeed = 175.0;
//new plname[MAX_PLAYER_NAME];
new string[128];//era 256
new Float:oldposx, Float:oldposy, Float:oldposz;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && i != INVALID_PLAYER_ID)
{
if(SafeTime[i] > 0)
{
SafeTime[i]--;
}
if(SafeTime[i] == 1)
{
if(gPlayerAccount[i] == 1 && gPlayerLogged[i] == 0)
{
new loginname[64];
new loginstring[128];
GetPlayerName(i,loginname,64);
format(loginstring,sizeof(loginstring),"{FFFFFF}Welcome, {F81414} %s \n \n{FFFFFF}You can now login:\nPlease enter your {6EF83C}password {FFFFFF}below:",loginname);
ShowPlayerDialog(i,12346,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Exit");
}
}
if(GetPlayerState(i) == 2)
{
GetPlayerPos(i, TelePos[i][3], TelePos[i][4], TelePos[i][5]);
if(TelePos[i][5] > 550.0)
{
TelePos[i][0] = 0.0;
TelePos[i][1] = 0.0;
}
if(TelePos[i][0] != 0.0)
{
new Float:xdist = TelePos[i][3]-TelePos[i][0];
new Float:ydist = TelePos[i][4]-TelePos[i][1];
new Float:sqxdist = xdist*xdist;
new Float:sqydist = ydist*ydist;
new Float:distance = (sqxdist+sqydist)/31;
if(gSpeedo[i] == 2)
{
if(distance <10)
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
}
if(distance > 10 && distance < 100)
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
}
if(distance > 100)
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
}
GameTextForPlayer(i, string, 2000, 5);
}
/*if(distance > maxspeed && PlayerInfo[i][pAdmin] < 1)
{
new tmpcar = GetPlayerVehicleID(i);
if(!IsAPlane(tmpcar))
{
GetPlayerName(i, plname, sizeof(plname));
format(string, sizeof(string), "AdmWarning: [%d]%s %.0f mph",i,plname,distance);
ABroadCast(COLOR_YELLOW,string,1);
}
}*/
}
if(TelePos[i][5] < 550.0 && TelePos[i][3] != 0.0)
{
TelePos[i][0] = TelePos[i][3];
TelePos[i][1] = TelePos[i][4];
}
}
if(PlayerInfo[i][pLocal] != 255 && PlayerInfo[i][pInt] != 0)
{
new house = PlayerInfo[i][pLocal];
GetPlayerPos(i, oldposx, oldposy, oldposz);
if(oldposz != 0.0)
{
if(oldposz < 600.0)
{
if(house > 10000)
{
new tmpcar = GetPlayerVehicleID(i);
if (!PlayerToPoint(6, i,1040.6,-1021.0,31.7) && house == 10001 ||!PlayerToPoint(6, i,-2720.5,217.5,4.1) && house == 10002 ||!PlayerToPoint(6, i,2644.6,-2044.9,13.3) && house == 10003)
{
if (GetPlayerState(i) == 2)
{
SetVehiclePos(tmpcar, HouseCarSpawns[tmpcar-1][0], HouseCarSpawns[tmpcar-1][1], HouseCarSpawns[tmpcar-1][2]);
SetVehicleZAngle(tmpcar, HouseCarSpawns[tmpcar-1][3]);
}
else
{
SetPlayerPos(i, HouseCarSpawns[tmpcar-1][0], HouseCarSpawns[tmpcar-1][1], HouseCarSpawns[tmpcar-1][2]);
}
new oldcash = gSpentCash[i];
new Total = GetPlayerCash(i) - oldcash;
printf("Total %d = GetPlayerCash(playerid) %d - oldcash %d",Total,GetPlayerCash(i),oldcash);
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string),"<< %s has left the homemodshop with $%d >>",name,Total);
PayLog(string);
gSpentCash[i] = 0;
TelePos[i][0] = 0.0;
TelePos[i][1] = 0.0;
PlayerInfo[i][pLocal] = 255;
SetPlayerInterior(i,0);
PlayerInfo[i][pInt] = 0;
Spectate[i] = 255;
}
}
if(house == 241)//City Hall
{
SetPlayerInterior(i,0);
SetPlayerPos(i,1480.9103,-1770.3743,18.7958);
PlayerInfo[i][pInt] = 0;
PlayerInfo[i][pLocal] = 255;
}
if(house == 242)
{
SetPlayerInterior(i,0);
SetPlayerPos(i,1073.0619,-344.5148,73.9922);
PlayerInfo[i][pInt] = 0;
PlayerInfo[i][pLocal] = 255;
}
if(house >= 99 && house != 10000)
{
SetPlayerPos(i, BizzInfo[house-99][bEntranceX], BizzInfo[house-99][bEntranceY],BizzInfo[house-99][bEntranceZ]); // Warp the player
PlayerInfo[i][pLocal] = 255;
SetPlayerInterior(i,0);
PlayerInfo[i][pInt] = 0;
}
else if(house < 99 && house != 10000)
{
SetPlayerPos(i, HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]); // Warp the player
PlayerInfo[i][pLocal] = 255;
SetPlayerInterior(i,0);
PlayerInfo[i][pInt] = 0;
SetPlayerVirtualWorld(i,0);
PlayerInfo[i][pVirWorld] = 0;
}
}
}
}
if(CellTime[i] > 0)
{
if (CellTime[i] == cchargetime)
{
CellTime[i] = 1;
if(Mobile[Mobile[i]] == i)
{
CallCost[i] = CallCost[i]+callcost;
}
}
CellTime[i] = CellTime[i] +1;
if (Mobile[Mobile[i]] == 255 && CellTime[i] == 5)
{
if(IsPlayerConnected(Mobile[i]))
{
new called[MAX_PLAYER_NAME];
GetPlayerName(Mobile[i], called, sizeof(called));
format(string, sizeof(string), "* %s's phone rings.", called);
RingTone[Mobile[i]] = 10;
ProxDetector(30.0, Mobile[i], string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
if(CellTime[i] == 0 && CallCost[i] > 0)
{
format(string, sizeof(string), "~w~The call cost~n~~r~$%d",CallCost[i]);
GivePlayerCash(i, -CallCost[i]);
SBizzInfo[2][sbTill] += CallCost[i];
ExtortionSBiz(2, CallCost[i]);
GameTextForPlayer(i, string, 5000, 1);
CallCost[i] = 0;
}
if(BowlingTimer[i] > 0) BowlingTimer[i] --;
if(PacaneleTimer[i] > 0) PacaneleTimer[i] --;
if(TransportTime[i] > 0)
{//Taxi driver and passenger only
if(TransportTime[i] >= 16)
{
TransportTime[i] = 1;
if(TransportDriver[i] < 999)
{
if(IsPlayerConnected(TransportDriver[i]))
{
TransportCost[i] += TransportValue[TransportDriver[i]];
TransportCost[TransportDriver[i]] = TransportCost[i];
}
}
}
TransportTime[i] += 1;
format(string, sizeof(string), "~r~%d ~w~: ~g~$%d",TransportTime[i],TransportCost[i]);
GameTextForPlayer(i, string, 15000, 6);
}
}
}
return 1;
}
UP... Other solution, please ?