Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Recommended Posts

Posted

Salutare! Am create un tutorial simplu pentru a implementa un sistem AFK/Back in serverul vostru de SA:MP. Acest sistem permite jucatorilor sa intre in modul AFK si sa se intoarca la joc atunci cand doresc. Voi explica pasii necesari pentru implementarea acestui sistem folosind limbajul de scripting Pawn.

[Pasul 1: Declarare variabile]

Inainte de a incepe implementarea, trebuie sa declaram urmatoarea variabila:

new AFKMode[MAX_PLAYERS];

[Pasul 2: Comanda /afk

Pentru a activa AFK, am creat comanda /afk. Aceasta comanda are urmatorul cod:

CMD:afk(playerid, params[])
{
    if (AFKMode[playerid]) return SendClientMessage(playerid, COLOR_RED, "Esti deja AFK.");
    AFKMode[playerid] = 1;
    new string[256], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    TogglePlayerControllable(playerid, 0);
    format(string, sizeof(string), "%s este acum AFK.", pname);
    SendClientMessageToAll(COLOR_YELLOW, string);
    return 1;
}

[Pasul 3: Comanda /back

Pentru a reveni la joc din modul AFK, am creat comanda /back. Aceasta comanda are urmatorul cod:

CMD:back(playerid, params[])
{
    if (!AFKMode[playerid]) return SendClientMessage(playerid, COLOR_RED, "Nu esti afk.");
    AFKMode[playerid] = 0;
    new string[256], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(string));
    TogglePlayerControllable(playerid, 1);
    format(string, sizeof(string), "%s nu mai este acum AFK.", pname);
    SendClientMessageToAll(COLOR_YELLOW, string);
    return 1;
}

Aceasta a fost o scurta introducere despre cum puteti implementa un sistem AFK/Back in serverul vostru de SA:MP. Sper ca acest tutorial a fost util si ca va ajutat!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.