APLY-ZONE
Bine ai venit vizitatorule, daca vrei sa ai acces la toate resursele forumului trebuie sa detii un cont. Daca nu detii unul deja iti poti face un cont nou aici : http://aply-zone.forumotion.com/register?agreed=true&step=2

sistem AFK+Back

In jos

sistem AFK+Back

Mesaj Scris de Versus la data de Mar Aug 13, 2013 7:20 am

Pasul 1: Lla inceput gm-ului adaugam:
Code:
new afk[MAX_PLAYERS];

Pasul 2: Cautam in GM linia public OnPlayerConnect(playerid)
Code:
afk[playerid] = 0;

Pasul 3: Cautam in GM linia public OnPlayerCommand
Aici trebuie sa adaugam trei comenzi /afk /back /afklist

Comanda /afk:
Code:
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;
}

Comanda /back:
Code:
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;
}

Comanda /afklist:
Code:
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[playerid] == 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;
}
avatar
Versus
Fondator
Fondator

Mesaje : 151
Puncte : 448
Reputatie : 1
Data de inscriere : 11/08/2013
Localizare : constanta

Vezi profilul utilizatorului

Sus In jos

Re: sistem AFK+Back

Mesaj Scris de SPeeDStriKe la data de Mier Aug 14, 2013 1:00 pm

Multimim !
avatar
SPeeDStriKe
Membru
Membru

Mesaje : 913
Puncte : 994
Reputatie : 13
Data de inscriere : 12/08/2013
Varsta : 23
Localizare : Bucuresti

Vezi profilul utilizatorului http://aply-zone.hitforum.ro/profile?mode=editprofile

Sus In jos

Sus

- Subiecte similare

 
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum