Jump to content
  • 0

nevoie /autosleep comanda


JoeMirana

Question

Am nevoie de o comanda /autosleep

cand jucatorii se conecteaza la server automatic go sleep

porunca mea /sleep:

CMD:sleep(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You need to login first.");
	if(InHouse[playerid] > -1)
    {
        if(PlayerInfo[playerid][pWantedLevel] == 0)
		{
            if(PlayerInfo[playerid][pSleeping] == 0)
			{
   				PlayerInfo[playerid][pSleeping] = 1;
				TogglePlayerControllable(playerid,0);
     			//SCM(playerid, COLOR_WHITE, "Acum poti ramane AFK fara a primi kick. Foloseste /sleep din nou cand vrei sa revi in joc.");
				SCM(playerid, COLOR_WHITE, "Minimizarea jocului (alt-tab) poate provoca unele buguri. Este recomandat sa apesi ESC inainte de a minimiza jocul.");
                LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
				SetPlayerColor(playerid,COLOR_GRAD2);
				PlayerInfo[playerid][pFreezed] = 1;
			}
			else
			{
				IsPlayerAFK[playerid] = 0;
				PlayerInfo[playerid][pSleeping] = 0;
				TogglePlayerControllable(playerid,1);
				ClearAnimations(playerid);
                SCM(playerid, COLOR_WHITE, "Bine ai revenit!");
				SetPlayerToTeamColor(playerid);
				PlayerInfo[playerid][pFreezed] = 0;
		    }
        }
        else
		{
            SCM(playerid, COLOR_WHITE, "{FFB870}You can not sleep, because you have wanted.");
			return 1;
        }
    }
    else return SCM(playerid, COLOR_WHITE, "Nu esti intr-o casa. Poti dormi doar in case.");
	return 1;
}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Salut @JoeMirana,

Pai e foarte simplu, faci o salvare in baza de date, spre ex cum se salveaza levelul: PlayerInfo[playerid][pLevel]

Sa zicem ca tu adaugi variabila pAutoSleep. Cauti locul in care salvezi tu variabilele jucatorilor, care se salveaza in baza de date, si adaugi o noua variabila (ex: pAutoSleep)

Dupa care, va trebui sa adaugi in tabelul users (sau players, sau unde ti se salveaza tie conturile), adaugi o coluana noua, spre ex: AutoSave, care va fi de tip INT (valoarea 2), conform definitiei (AS DEFINED), 0. (poti sa copiezi un rand cum ar fi Level, stii ce zic).

Acum, va trebui sa verifici incarci datele din baza, din coloana AutoSleep (pe care ai creat o in baza de date), in variabila pAutoSleep, pe care ai adaugat o la primul pas.

Iar acum, tot ce iti mai ramane de facut e sa o verificare la conectare, spre exemplu cauti unde iti afiseaza un mesaj atunci cand te conectezi (ex: Welcome back, shane). Exemplu: if(PlayerInfo[playerid][pAutoSleep]) Sleep(playerid);

Va trebui sa creezi functia (sau publicul, cum ai tu), Sleep. Ex:

function Sleep(playerid) {
	//comanda ta /sleep (fara CMD:sleep etc etc)
	return true;
}

Sau, pe ZCMD parca puteai sa returnezi direct o comanda, poti cauta pe net ceva despre asta, si returnezi direct comanda /sleep atunci cand te conectezi.

Cam atat, nu am dispozitia sa-ti explic mai detaliat, ti-am spus exact ce trebuie sa faci, acum.. ai nevoie de niste cunostine basic si sa intelegi logic.

Daca te-am ajutat =>

spacer.png

Link to comment
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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.