[23:29:42] [warning] client exceeded 'ackslimit' MYIP:64163 (3070) Limit: 3000/sec
forward HoraSave(); public HoraSave() { new Hour, Minute, Second; gettime(Hour, Minute, Second); if ( Hour == 00 && Minute == 30 || Hour == 01 && Minute == 30 || Hour == 02 && Minute == 30 || Hour == 03 && Minute == 30 || Hour == 04 && Minute == 30 || Hour == 05 && Minute == 30 || Hour == 06 && Minute == 30 || Hour == 07 && Minute == 30 || Hour == 08 && Minute == 30 || Hour == 09 && Minute == 30 || Hour == 10 && Minute == 30 || Hour == 11 && Minute == 30 || Hour == 12 && Minute == 30 || Hour == 13 && Minute == 30 || Hour == 14 && Minute == 30 || Hour == 15 && Minute == 30 || Hour == 16 && Minute == 30 || Hour == 17 && Minute == 30 || Hour == 18 && Minute == 30 || Hour == 19 && Minute == 30 || Hour == 20 && Minute == 30 || Hour == 21 && Minute == 30 || Hour == 22 && Minute == 30 || Hour == 23 && Minute == 30) { SalvarCasas(); SalvarFactions(); SalvarServer(); SendClientMessageToAll(COLOR_LIGHTRED, "SERVER SAVE!"); } return 1; }
stock SalvarCasas() { for(new houseid; houseid < MAX_HOUSES; houseid++) { new query[1030]; format(query, sizeof(query), "UPDATE `houses` SET `OutPosX` = '%f', `OutPosY` = '%f', `OutPosZ` = '%f', `InPosX` = '%f', `InPosY` = '%f', `InPosZ` = '%f', `World` = '%d', `Price` = '%d', `Interior` = '%d', `Locked` = '%d', `Dono` = '%s', `FHQ` = '%d', `Money` = '%d', `Maconha` = '%d', `Material` = '%d', `Owner` = '%d', `hlastlogin` = '%d' WHERE `ID` = '%i' ", HouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], HouseInfo[houseid][InPosX], HouseInfo[houseid][InPosY], HouseInfo[houseid][InPosZ], HouseInfo[houseid][World], HouseInfo[houseid][Price], HouseInfo[houseid][Interior], HouseInfo[houseid][Locked], HouseInfo[houseid][Dono], HouseInfo[houseid][FHQ], HouseInfo[houseid][Money], HouseInfo[houseid][Maconha], HouseInfo[houseid][Material], HouseInfo[houseid][Owner], HouseInfo[houseid][hlastlogin], houseid); mysql_pquery(ConnectMYSQL, query); } return 1; }
stock SalvarFactions() { for(new factionid; factionid < MAX_FACTIONS; factionid++) { new query[1030]; format(query, sizeof(query), "UPDATE `factions` SET `facname` = '%s', `HQposX` = '%f', `HQposY` = '%f', `HQposZ` = '%f', `pistolSPAWNfac` = '%d', `shotgunSPAWNfac` = '%d', `submachineSPAWNfac` = '%d', `assaultSPAWNfac` = '%d', `sniperSPAWNfac` = '%d', `meleeSPAWNfac` = '%d', `cofredinheiro` = '%d', `cofresalario` = '%d', `cofrematerial` = '%d', `cofremaconha` = '%d', `hq` = '%d' WHERE `ID` = '%i' ", FactionInfo[factionid][facname], FactionInfo[factionid][HQposX], FactionInfo[factionid][HQposY], FactionInfo[factionid][HQposZ], FactionInfo[factionid][pistolSPAWNfac], FactionInfo[factionid][shotgunSPAWNfac], FactionInfo[factionid][submachineSPAWNfac], FactionInfo[factionid][assaultSPAWNfac], FactionInfo[factionid][sniperSPAWNfac], FactionInfo[factionid][meleeSPAWNfac], FactionInfo[factionid][cofredinheiro], FactionInfo[factionid][cofresalario], FactionInfo[factionid][cofrematerial], FactionInfo[factionid][cofremaconha], FactionInfo[factionid][hq], factionid); mysql_pquery(ConnectMYSQL, query); format(query, sizeof(query), "UPDATE `factions` SET `membro1` = '%s', `membro2` = '%s', `membro3` = '%s', `membro4` = '%s', `membro5` = '%s', `membro6` = '%s', `membro7` = '%s', `membro8` = '%s', `membro9` = '%s', `membro10` = '%s', `membro11` = '%s', `membro12` = '%s', `membro13` = '%s', `membro14` = '%s', `membro15` = '%s' WHERE `ID` = '%i' ", FactionInfo[factionid][membro1], FactionInfo[factionid][membro2], FactionInfo[factionid][membro3], FactionInfo[factionid][membro4], FactionInfo[factionid][membro5], FactionInfo[factionid][membro6], FactionInfo[factionid][membro7], FactionInfo[factionid][membro8], FactionInfo[factionid][membro9], FactionInfo[factionid][membro10], FactionInfo[factionid][membro11], FactionInfo[factionid][membro12], FactionInfo[factionid][membro13], FactionInfo[factionid][membro14], FactionInfo[factionid][membro15], factionid); mysql_pquery(ConnectMYSQL, query); format(query, sizeof(query), "UPDATE `factions` SET `cargo1` = '%d', `cargo2` = '%d', `cargo3` = '%d', `cargo4` = '%d', `cargo5` = '%d', `cargo6` = '%d', `cargo7` = '%d', `cargo8` = '%d', `cargo9` = '%d', `cargo10` = '%d', `cargo11` = '%d', `cargo12` = '%d', `cargo13` = '%d', `cargo14` = '%d', `cargo15` = '%d' WHERE `ID` = '%i' ", FactionInfo[factionid][cargo1], FactionInfo[factionid][cargo2], FactionInfo[factionid][cargo3], FactionInfo[factionid][cargo4], FactionInfo[factionid][cargo5], FactionInfo[factionid][cargo6], FactionInfo[factionid][cargo7], FactionInfo[factionid][cargo8], FactionInfo[factionid][cargo9], FactionInfo[factionid][cargo10], FactionInfo[factionid][cargo11], FactionInfo[factionid][cargo12], FactionInfo[factionid][cargo13], FactionInfo[factionid][cargo14], FactionInfo[factionid][cargo15], factionid); mysql_pquery(ConnectMYSQL, query); } return 1; }
stock SalvarServer() { new query[1030]; format(query, sizeof(query), "UPDATE `server` SET `god` = '%s', `cm1` = '%s', `cm2` = '%s', `gm1` = '%s', `gm2` = '%s', `gm3` = '%s', `gm4` = '%s', `sa1` = '%s', `sa2` = '%s', `sa3` = '%s', `sa4` = '%s', `adm1` = '%s', `adm2` = '%s', `adm3` = '%s', `adm4` = '%s' ", admlist[god], admlist[cm1], admlist[cm2], admlist[gm1], admlist[gm2], admlist[gm3], admlist[gm4], admlist[sa1], admlist[sa2], admlist[sa3], admlist[sa4], admlist[adm1], admlist[adm2], admlist[adm3], admlist[adm4]); mysql_pquery(ConnectMYSQL, query); format(query, sizeof(query), "UPDATE `server` SET `mod1` = '%s', `mod2` = '%s', `mod3` = '%s', `mod4` = '%s', `mod5` = '%s', `mod6` = '%s', `mod7` = '%s', `mod8` = '%s', `tutor1` = '%s', `tutor2` = '%s', `tutor3` = '%s', `tutor4` = '%s', `tutor5` = '%s', `tutor6` = '%s', `tutor7` = '%s', `tutor8` = '%s' ", admlist[mod1], admlist[mod2], admlist[mod3], admlist[mod4], admlist[mod5], admlist[mod6], admlist[mod7], admlist[mod8], admlist[tutor1], admlist[tutor2], admlist[tutor3], admlist[tutor4], admlist[tutor5], admlist[tutor6], admlist[tutor7], admlist[tutor8]); mysql_pquery(ConnectMYSQL, query); format(query, sizeof(query), "UPDATE `server` SET `donoDende` = '%d', `donoComplexo` = '%d', `donoUrubu` = '%d', `donoMangueira` = '%d', `donoRocinha` = '%d', `donoTitanic` = '%d' ", donoDende, donoComplexo, donoUrubu, donoMangueira, donoRocinha, donoTitanic); mysql_pquery(ConnectMYSQL, query); return 1; }
Код:
if ( Hour == 00 && Minute == 30 || Hour == 01 && Minute == 30 || Hour == 02 && Minute == 30 || Hour == 03 && Minute == 30 || Hour == 04 && Minute == 30 || Hour == 05 && Minute == 30 || Hour == 06 && Minute == 30 || Hour == 07 && Minute == 30 || Hour == 08 && Minute == 30 || Hour == 09 && Minute == 30 || Hour == 10 && Minute == 30 || Hour == 11 && Minute == 30 || Hour == 12 && Minute == 30 || Hour == 13 && Minute == 30 || Hour == 14 && Minute == 30 || Hour == 15 && Minute == 30 || Hour == 16 && Minute == 30 || Hour == 17 && Minute == 30 || Hour == 18 && Minute == 30 || Hour == 19 && Minute == 30 || Hour == 20 && Minute == 30 || Hour == 21 && Minute == 30 || Hour == 22 && Minute == 30 || Hour == 23 && Minute == 30) |
if(Minute == 30)
11/02/2016, 12:30 AM * #2 Vince Godfather * * Join Date: Sep 2007 Location: Belgium Posts: 9,082 Reputation: 2181 Re: Why it stop my server? Quote: Code: if ( Hour == 00 && Minute == 30 || Hour == 01 && Minute == 30 || Hour == 02 && Minute == 30 || Hour == 03 && Minute == 30 || Hour == 04 && Minute == 30 || Hour == 05 && Minute == 30 || Hour == 06 && Minute == 30 || Hour == 07 && Minute == 30 || Hour == 08 && Minute == 30 || Hour == 09 && Minute == 30 || Hour == 10 && Minute == 30 || Hour == 11 && Minute == 30 || Hour == 12 && Minute == 30 || Hour == 13 && Minute == 30 || Hour == 14 && Minute == 30 || Hour == 15 && Minute == 30 || Hour == 16 && Minute == 30 || Hour == 17 && Minute == 30 || Hour == 18 && Minute == 30 || Hour == 19 && Minute == 30 || Hour == 20 && Minute == 30 || Hour == 21 && Minute == 30 || Hour == 22 && Minute == 30 || Hour == 23 && Minute == 30) Gosh, that's got to be the most redundant piece of code I have ever seen. What exactly prevents you from simply writing: Code: if(Minute == 30) ? ____ |
as Vince said change the last line to if(Minute == 30 ||
like all |
SetTimer("HoraSave",59000,1); // 59 segs
forward HoraSave(); public HoraSave() { new Hour, Minute, Second; gettime(Hour, Minute, Second); if (Minute == 30) { SalvarCasas(); SalvarFactions(); SalvarServer(); SendClientMessageToAll(COLOR_LIGHTRED, "SERVER SAVE!"); } return 1; }
stock SalvarFactions() { for(new factionid; factionid < MAX_FACTIONS; factionid++) { new rows, fields; cache_get_data(rows, fields); if(rows) { new query[1030]; format(query, sizeof(query), "UPDATE `factions` SET `facname` = '%s', `HQposX` = '%f', `HQposY` = '%f', `HQposZ` = '%f', `pistolSPAWNfac` = '%d', `shotgunSPAWNfac` = '%d', `submachineSPAWNfac` = '%d', `assaultSPAWNfac` = '%d', `sniperSPAWNfac` = '%d', `meleeSPAWNfac` = '%d', `cofredinheiro` = '%d', `cofresalario` = '%d', `cofrematerial` = '%d', `cofremaconha` = '%d', `hq` = '%d' WHERE `ID` = '%i' ", FactionInfo[factionid][facname], FactionInfo[factionid][HQposX], FactionInfo[factionid][HQposY], FactionInfo[factionid][HQposZ], FactionInfo[factionid][pistolSPAWNfac], FactionInfo[factionid][shotgunSPAWNfac], FactionInfo[factionid][submachineSPAWNfac], FactionInfo[factionid][assaultSPAWNfac], FactionInfo[factionid][sniperSPAWNfac], FactionInfo[factionid][meleeSPAWNfac], FactionInfo[factionid][cofredinheiro], FactionInfo[factionid][cofresalario], FactionInfo[factionid][cofrematerial], FactionInfo[factionid][cofremaconha], FactionInfo[factionid][hq], factionid); mysql_pquery(ConnectMYSQL, query); format(query, sizeof(query), "UPDATE `factions` SET `membro1` = '%s', `membro2` = '%s', `membro3` = '%s', `membro4` = '%s', `membro5` = '%s', `membro6` = '%s', `membro7` = '%s', `membro8` = '%s', `membro9` = '%s', `membro10` = '%s', `membro11` = '%s', `membro12` = '%s', `membro13` = '%s', `membro14` = '%s', `membro15` = '%s' WHERE `ID` = '%i' ", FactionInfo[factionid][membro1], FactionInfo[factionid][membro2], FactionInfo[factionid][membro3], FactionInfo[factionid][membro4], FactionInfo[factionid][membro5], FactionInfo[factionid][membro6], FactionInfo[factionid][membro7], FactionInfo[factionid][membro8], FactionInfo[factionid][membro9], FactionInfo[factionid][membro10], FactionInfo[factionid][membro11], FactionInfo[factionid][membro12], FactionInfo[factionid][membro13], FactionInfo[factionid][membro14], FactionInfo[factionid][membro15], factionid); mysql_pquery(ConnectMYSQL, query); format(query, sizeof(query), "UPDATE `factions` SET `cargo1` = '%d', `cargo2` = '%d', `cargo3` = '%d', `cargo4` = '%d', `cargo5` = '%d', `cargo6` = '%d', `cargo7` = '%d', `cargo8` = '%d', `cargo9` = '%d', `cargo10` = '%d', `cargo11` = '%d', `cargo12` = '%d', `cargo13` = '%d', `cargo14` = '%d', `cargo15` = '%d' WHERE `ID` = '%i' ", FactionInfo[factionid][cargo1], FactionInfo[factionid][cargo2], FactionInfo[factionid][cargo3], FactionInfo[factionid][cargo4], FactionInfo[factionid][cargo5], FactionInfo[factionid][cargo6], FactionInfo[factionid][cargo7], FactionInfo[factionid][cargo8], FactionInfo[factionid][cargo9], FactionInfo[factionid][cargo10], FactionInfo[factionid][cargo11], FactionInfo[factionid][cargo12], FactionInfo[factionid][cargo13], FactionInfo[factionid][cargo14], FactionInfo[factionid][cargo15], factionid); mysql_pquery(ConnectMYSQL, query); } } return 1; }
stock SalvarCasas() { for(new houseid; houseid < MAX_HOUSES; houseid++) { new rows, fields; cache_get_data(rows, fields); if(rows) { new query[1030]; format(query, sizeof(query), "UPDATE `houses` SET `OutPosX` = '%f', `OutPosY` = '%f', `OutPosZ` = '%f', `InPosX` = '%f', `InPosY` = '%f', `InPosZ` = '%f', `World` = '%d', `Price` = '%d', `Interior` = '%d', `Locked` = '%d', `Dono` = '%s', `FHQ` = '%d', `Money` = '%d', `Maconha` = '%d', `Material` = '%d', `Owner` = '%d', `hlastlogin` = '%d' WHERE `ID` = '%i' ", HouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], HouseInfo[houseid][InPosX], HouseInfo[houseid][InPosY], HouseInfo[houseid][InPosZ], HouseInfo[houseid][World], HouseInfo[houseid][Price], HouseInfo[houseid][Interior], HouseInfo[houseid][Locked], HouseInfo[houseid][Dono], HouseInfo[houseid][FHQ], HouseInfo[houseid][Money], HouseInfo[houseid][Maconha], HouseInfo[houseid][Material], HouseInfo[houseid][Owner], HouseInfo[houseid][hlastlogin], houseid); mysql_pquery(ConnectMYSQL, query); } } return 1; }
How is the function HoraSave() being called?
Is it in a timer that runs every second or so? Because that would explain your problem. All these queries would be sent every second for about a minute in duration if that's the case and could cause slowdowns. Also, in SalvarServer, you declare a variable FactionID but you never use it, so you're updating ALL rows in your server 100 times if you have 100 factions. There is no WHERE clause to be seen in those queries. And I don't get why you update all this info all at once? Most of the data doesn't even change. When saving those houses, why update the OutPosX and such coordinates? Do your houses move every hour or what? Save whatever must be saved, and only do it when it changes. Don't create such huge and many queries all at once. No wonder your server locks up and hangs for a while. When the owner of the house changes, update that and only that. Don't go updating all other never-changing data about the house, because it's position (outposx, outposy, outposz, inposx, inposy, inposz) hasn't changed, the price hasn't changed, so no need to update those values. |
Gosh, that's got to be the most redundant piece of code I have ever seen. What exactly prevents you from simply writing:
Код:
if(Minute == 30) |