CMD:shutdown(playerid) {
shutdownserver();
return 1;
}
forward shutdownserver();
public shutdownserver() {
SendRconCommand("exit");
return 1;
}
public OnGameModeExit() {
printf("1");
printf("2");
SalvarCasas();
printf("3");
SalvarGangs();
printf("4");
SalvarAtores();
printf("5");
SalvarEquipe();
printf("6");
SalvarVeiculos();
printf("7");
SalvarCaixas();
printf("8");
SalvarRadares();
printf("9");
SalvarGZs();
printf("10");
SalvarRoubos();
printf("11");
SalvarEmpresas();
printf("12");
mysql_close(ConnectMYSQL);
printf("13");
return 1;
}
[02:43:08] --- Server Shutting Down. [02:43:08] 1 [02:43:08] 2 [02:43:08] 3 [02:43:08] 4 [02:43:09] 5 [02:43:09] 6 [02:43:09] 7 [02:43:09] 8 [02:43:09] 9 [02:43:09] 10 [02:43:09] 11 [02:43:09] 12
public OnGameModeExit() {
mysql_close(ConnectMYSQL);
printf("13");
return 1;
}
CMD:shutdown(playerid)
{
shutdownserver(0);
return 1;
}
forward shutdownserver(step);
public shutdownserver(step)
{
if(step == 0)
{
printf("1");
printf("2");
SalvarCasas();
printf("3");
SalvarGangs();
printf("4");
SalvarAtores();
printf("5");
SalvarEquipe();
printf("6");
SalvarVeiculos();
printf("7");
SalvarCaixas();
printf("8");
SalvarRadares();
printf("9");
SalvarGZs();
printf("10");
SalvarRoubos();
printf("11");
SalvarEmpresas();
printf("12");
SetTimerEx("shutdownserver", 3000, false, "i", 1);
}
else if(step == 1)
{
mysql_close(ConnectMYSQL);
printf("13");
SetTimerEx("shutdownserver", 3000, false, "i", 2);
}
else
{
SendRconCommand("exit");
}
return 1;
}
CMD:shutdown(playerid) {
shutdownserver();
return 1;
}
forward shutdownserver();
public shutdownserver() {
SendRconCommand("exit");
return 1;
}
CMD:shutdown(playerid)
{
SendRconCommand("exit");
return 1;
}
forward SalvarCasas(typeSS);
public SalvarCasas(typeSS) {
new query[1030];
for(new houseid = 1; houseid < MAX_HOUSES; houseid++) {
mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `houses` SET `hType` = '%d', `hOwner` = '%d', `hOutPosX` = '%f', `hOutPosY` = '%f', `hOutPosZ` = '%f', `hLocked` = '%d', `hAlarm` = '%d', `hLockLVL` = '%d', `hArrombada` = '%d', `hMoney` = '%d', `hMaconha` = '%d', `hMaterial` = '%d', `hPassword` = '%d', `FHQ` = '%d' WHERE `hID` = '%i'",
HouseInfo[houseid][hType],
HouseInfo[houseid][hOwner],
HouseInfo[houseid][hOutPosX],
HouseInfo[houseid][hOutPosY],
HouseInfo[houseid][hOutPosZ],
HouseInfo[houseid][hLocked],
HouseInfo[houseid][hAlarm],
HouseInfo[houseid][hLockLVL],
HouseInfo[houseid][hArrombada],
HouseInfo[houseid][hMoney],
HouseInfo[houseid][hMaconha],
HouseInfo[houseid][hMaterial],
HouseInfo[houseid][hPassword],
HouseInfo[houseid][FHQ],
houseid);
mysql_pquery(ConnectMYSQL, query);
}
if(typeSS > 0) {
if(acabou_de_salvar_casas) {
SalvarGangs(typeSS);
}
/* ao inves de
SetTimerEx("SalvarGangs", TIME_SAVE_STEP, false, "i", typeSS);
*/
}
}
Vocк estб usando queries paralelas, nгo tem como fazer esse passo-a-passo, sу usando mysql_query. Ainda sim o timer serб necessбrio depois de mysql_close.
Se ainda nгo resolveu com os timers, aumente o tempo para 8000ms e remova mysql_close da OnGameModeExit. |
//para fechar
shutdownserver(0);
forward query_CloseMySQL();
public query_CloseMySQL()
{
mysql_close(ConnectMYSQL);
SetTimerEx("shutdownserver", 5000, false, "i", 1);
return 1;
}
forward shutdownserver(step);
public shutdownserver(step)
{
if(step == 0)
{
SalvarCasas(); //lembrando, todos os saves tem que estar em mysql_tquery
SalvarGangs();
SalvarAtores();
SalvarEquipe();
SalvarVeiculos();
SalvarCaixas();
SalvarRadares();
SalvarGZs();
SalvarRoubos();
SalvarEmpresas();
mysql_tquery(ConnectMYSQL, "SELECT 1", "query_CloseMySQL");
}
else
{
SendRconCommand("exit");
}
return 1;
}
Sу se usar mysql_tquery nos saves e uma no final de tudo que vai chamar uma callback para dar mysql_close.
PHP код:
|