Jump to content
  • 0
NERS

Server restart

Question

De ce cand se restarteaza serverul cu GameModeExit() [cand inchid samp-server merge normal], reintru si incerc sa folosesc o comanda pe cineva imi spune ca nu e conectat?

Inainte de restart mergea totul, am incercat sa le dau kick inainte de restart dar nu merge nici asta

Cod: (la query-uri am pus PlayerInfo [ i ], nu se vede acel [ i ] pentru ca face textul italic, cred)

forward Restart();
public Restart() return GameModeExit();

YCMD:restart(playerid, params[], help) {
    if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid,-1,AdminOnly);
    new query[360];

    SCMTA(COLOR_CLIENT," ");
    format(query,sizeof(query),"(( Admin %s: Server-ul se va restarta in cateva secunde! ))", GetName(playerid));
    SCMTA(COLOR_CLIENT,query);
    format(query, sizeof(query), "(( Admin %s: Veti primi kick, o sa trebuiasca sa reintrati! ))", GetName(playerid));
    SCMTA(COLOR_CLIENT,query);
    SCMTA(COLOR_CLIENT, " ");
    SendAdminMessage(COLOR_CLIENT,"Saving player data...",1);
    SetTimer("Restart", 5000, false);

    format(query, sizeof(query), "UPDATE `stuff` SET `GoalAmount`='%d'", GoalAmount);
    mysql_tquery(SQL, query, "", "");

    foreach(Player, i) {
        CallLocalFunction("OnPlayerDisconnect", "is[20]", i, "Server Restart");

        format(query, sizeof(query), "UPDATE `users` SET `CChar`='%d', `PaydayTime`='%d', `Energy`='%d', `EnergyJob`='%d', `Pass`='%d', `PassXP`='%d', `PassTier`='%d', `PassLevel`='%d' WHERE `ID`='%d'", PlayerInfo[pChar], PlayerInfo[pPaydayTime], PlayerInfo[pEnergy], PlayerInfo[pEnergyJob], PlayerInfo[pPass], PlayerInfo[pPassXP], PlayerInfo[pPassTier], PlayerInfo[pPassLevel], PlayerInfo[pSQLID]);
        mysql_tquery(SQL, query, "", "");

        if(PlayerInfo[pGoalContributor] == 1) {
            Iter_Remove(GoalContributors, i);
            format(query, sizeof(query), "UPDATE `users` SET `GoalContributor`='1' WHERE `ID`='%d'", PlayerInfo[pSQLID]);
            mysql_tquery(SQL, query, "", "");
        }
        KickEx(i);
    }
    return 1;
}

Edited by NERS

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

 

Incearca asa.

public Restart() return GameModeExitFunc();

forward GameModeExitFunc();

public GameModeExitFunc()
{
    GameModeExit();
}

 

Edited by zNx[]

Share this post


Link to post
Share on other sites
  • 0
Acum 18 minute, zNx[] a spus:

 

Incearca asa.

public Restart() return GameModeExitFunc();

forward GameModeExitFunc();

public GameModeExitFunc()
{
    GameModeExit();
}

 

acelasi lucru

Share this post


Link to post
Share on other sites
  • 0

Atunci incearca sa adaugi in timer ce ai aici 

format(query, sizeof(query), "UPDATE `stuff` SET `GoalAmount`='%d'", GoalAmount);
    mysql_tquery(SQL, query, "", "");

    foreach(Player, i) {
        CallLocalFunction("OnPlayerDisconnect", "is[20]", i, "Server Restart");

        format(query, sizeof(query), "UPDATE `users` SET `CChar`='%d', `PaydayTime`='%d', `Energy`='%d', `EnergyJob`='%d', `Pass`='%d', `PassXP`='%d', `PassTier`='%d', `PassLevel`='%d' WHERE `ID`='%d'", PlayerInfo[pChar], PlayerInfo[pPaydayTime], PlayerInfo[pEnergy], PlayerInfo[pEnergyJob], PlayerInfo[pPass], PlayerInfo[pPassXP], PlayerInfo[pPassTier], PlayerInfo[pPassLevel], PlayerInfo[pSQLID]);
        mysql_tquery(SQL, query, "", "");

        if(PlayerInfo[pGoalContributor] == 1) {
            Iter_Remove(GoalContributors, i);
            format(query, sizeof(query), "UPDATE `users` SET `GoalContributor`='1' WHERE `ID`='%d'", PlayerInfo[pSQLID]);
            mysql_tquery(SQL, query, "", "");
        }
        KickEx(i);

Share this post


Link to post
Share on other sites
  • 0
Acum 6 minute, zNx[] a spus:

Atunci incearca sa adaugi in timer ce ai aici 

format(query, sizeof(query), "UPDATE `stuff` SET `GoalAmount`='%d'", GoalAmount);
    mysql_tquery(SQL, query, "", "");

    foreach(Player, i) {
        CallLocalFunction("OnPlayerDisconnect", "is[20]", i, "Server Restart");

        format(query, sizeof(query), "UPDATE `users` SET `CChar`='%d', `PaydayTime`='%d', `Energy`='%d', `EnergyJob`='%d', `Pass`='%d', `PassXP`='%d', `PassTier`='%d', `PassLevel`='%d' WHERE `ID`='%d'", PlayerInfo[pChar], PlayerInfo[pPaydayTime], PlayerInfo[pEnergy], PlayerInfo[pEnergyJob], PlayerInfo[pPass], PlayerInfo[pPassXP], PlayerInfo[pPassTier], PlayerInfo[pPassLevel], PlayerInfo[pSQLID]);
        mysql_tquery(SQL, query, "", "");

        if(PlayerInfo[pGoalContributor] == 1) {
            Iter_Remove(GoalContributors, i);
            format(query, sizeof(query), "UPDATE `users` SET `GoalContributor`='1' WHERE `ID`='%d'", PlayerInfo[pSQLID]);
            mysql_tquery(SQL, query, "", "");
        }
        KickEx(i);

acelasi lucru..

am rezolvat "partial"

am facut o noua variabila 'serverrestart' si la onplayerdisconnect am pus sa ii updateze status-ul doar cand serverrestart este 0, dar comenzile de ex /sellmats /selldrugs etc merg, /accept nu

Share this post


Link to post
Share on other sites
  • 0

Sau daca nu fa asa:

 

1: Schimba cu comanda asta:

Creezi variabila new  RestartTime;
2: Schimba cu comanda asta:
YCMD:restart(playerid, params[], help) {
	if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid, COLOR_WHITE, AdminOnly);
	new time, string[180];
	if(sscanf(params, "i", time)) return SCM(playerid,COLOR_GREY, "{FFFF00}Syntaxa: {FFFFFF}/restart <timp in minute>");
	format(string, sizeof(string), "(( Admin %s: {FF9696}Urmeaza un restart in %d ore (%d minute). {A9C4E4}))", GetName(playerid), time/60, time);
	SCMTA(COLOR_CLIENT, string);
	RestartTime = time*60;
	return 1; }
                                        
 3.Te duci la un timer de 1000 de milisecunde din Gamemode-ul tau, poti cauta daca ai task "[1000]", si o sa te duca la timer, sau il poti gasii singur la ongamemodeinit, dupa care adaugi asta.
    new znxtext[126], new query[360];                                   
    if(RestartTime >= 1) {
	    RestartTime--;
		if(RestartTime <= 60) {
			format( znxtext, sizeof(znxtext), "~w~Urmeaza un restart in~n~~r~%d secunde", RestartTime);
			GameTextForAll( znxtext, 1100, 4 );
             format(query, sizeof(query), "UPDATE `stuff` SET `GoalAmount`='%d'", GoalAmount);
    mysql_tquery(SQL, query, "", "");

    foreach(Player, i) {
        CallLocalFunction("OnPlayerDisconnect", "is[20]", i, "Server Restart");

        format(query, sizeof(query), "UPDATE `users` SET `CChar`='%d', `PaydayTime`='%d', `Energy`='%d', `EnergyJob`='%d', `Pass`='%d', `PassXP`='%d', `PassTier`='%d', `PassLevel`='%d' WHERE `ID`='%d'", PlayerInfo[pChar], PlayerInfo[pPaydayTime], PlayerInfo[pEnergy], PlayerInfo[pEnergyJob], PlayerInfo[pPass], PlayerInfo[pPassXP], PlayerInfo[pPassTier], PlayerInfo[pPassLevel], PlayerInfo[pSQLID]);
        mysql_tquery(SQL, query, "", "");

        if(PlayerInfo[pGoalContributor] == 1) {
            Iter_Remove(GoalContributors, i);
            format(query, sizeof(query), "UPDATE `users` SET `GoalContributor`='1' WHERE `ID`='%d'", PlayerInfo[pSQLID]);
            mysql_tquery(SQL, query, "", "");                
		 	}
          }
        }                    
	    if(RestartTime == 3) {
			foreach(Player, i) {
				if(IsPlayerLogged[i] == 1 && PlayerInfo[i][pAdmin] < 7) KickEx(i);
			}
		}
	    if(RestartTime == 0) GameModeExit();
	}                                    
                                        
                                        

 

Share this post


Link to post
Share on other sites
  • 0

sincer sa fiu imi urasc viata pentru ca problema era de la comanda accept nu de la restart, mda.. imi cer scuze pt timpul irosit :(

solutie:

de la: if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Acel player nu este conectat.");

am schimbat in: if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, "Acel player nu este conectat.");

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

This site uses cookies. By continuing browsing, you agree to the use of this information. For more details, see Terms of Use and Privacy Policy.