Jump to content

[TUT]Cum faci un AFK System


NeKeRm@N

Recommended Posts

Multi mi-au zis pe messenger cum se face comanda /afk /back si /afklist si m-am gandit sa o pun aici ca un mic tutorial , sper sa nu fie ceva rau :

1.Mergem in gm si adaugam la inceputul gm-ului

new afk[MAX_PLAYERS];
2.Mergem la:
public OnPlayerConnect(playerid)
si adaugam
afk[playerid] = 0;
3.Adaugati comanda /afk dupa orice comanda pe care o aveti:
if(strcmp(cmd, "/afk", true) == 0)
{
    if(afk[playerid] == 0)
    {
           afk[playerid] = 1;
           SetPlayerColor(playerid,0x737373FF);
           TogglePlayerControllable(playerid,0);
           GetPlayerName(playerid, sendername, 24);
           format(string, 256, "%s is away from keyboard.", sendername);
           ProxDetector(20.0, playerid, string, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA);
    }
    return 1;
}
4.Adaugati comanda /back dupa comanda de mai sus(/afk)
if(strcmp(cmd, "/back", true) == 0)
{
    if(afk[playerid] == 1)
    {
           afk[playerid] = 0;
           SetPlayerToTeamColor(playerid);
           TogglePlayerControllable(playerid,1);
           GetPlayerName(playerid, sendername, 24);
           format(string, 256, "%s is no more away from keyboard.", sendername);
           ProxDetector(20.0, playerid, string, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA);
    }
    return 1;
}
5.Adaugati comanda /afklist dupa comanda de mai sus(/back):
if (strcmp("/afklist", cmdtext, true, 7) == 0)
{
    SendClientMessage(playerid, COLOR_YELLOW, ".:: AFK Players ::. ");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(afk[i]==1)
            {
                new name[128];
                GetPlayerName(i, name, MAX_PLAYER_NAME);
                format(string, 256, "Player: \"%s\" | ID: %d", name, i);
                SendClientMessage(playerid, COLOR_YELLOW, string);
            }
        }
    }
    return 1;
}
6. la linia
 SetPlayerColor(playerid,0x737373FF);
  de la comanda /afk puteti adauga in loc de
0x737373FF

alta culoare pe care va doriti!

Link to comment
Share on other sites

Ba copile tu tot timpu te oftici!

Si  in + de unde sti tu atat de multe ca eu nu stiu? omgf

Tu taci, ca mereu cand raspunzi tu la "Discutii scripting" esti praf, nu stii nimic aproape, si ma doare-n ... ceapa de ce spui tu de mine, stii cum se spune, sa nu bagi prostii in seama. Acum te-am bagat putin in seama, dar noh. Cine ma cunoaste mai bine stie ca stiu destul de bine scripting, ma rog. Sa nu dam in OFF-TOPIC.

EDIT: Fi-ti atenti ce PM:

Hai da-mi ban , ma nesimtitule!

Esti un mare imbecil!

Zici de mine ca's varza la script, dar tu nu sti nici cat am uitat eu in ultimi ani copile! =)) omfg ...

Vezi ca iti strici aspectu cu atat alauda pe care tio faci singur copile... ;)

Dute la scoala si invata matematica , poate asa o sa mai inveti si tu script...

Banned me :X

Banned me :X

Banned me :X

Banned me :X

Banned = Banat, Ban = Baneaza ... of, vai de capul tau. What a noob =)), sper sa ia warn.

PS: Ce legatura are matematica cu ce facem noi aici ? Eu scripting, tu nu stiu ce faci. Are legatura doar pe la unele calcule, la floaturi, dar nu e asa importanta matematica in pawno ... duh

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.