[TUTORIAL]Sistem AFK/BACK
2 participanți
Pagina 1 din 1
[TUTORIAL]Sistem AFK/BACK
Astazi va arat cum sa va faceti singuri propriul vostru sistem de AFK si BACK.
Deschideti GameMode-ul dvs. si la inceput scrieti :
Dati FIND si scrieti in casuta aceea OnPlayerConnect(playerid)
Si dedesupt puneti :
Dati din nou FIND si in casuta aceea scrieti OnPlayerCommand
Aici trebuie sa adaugam trei comenzi
AFK :
BACK :
AFKLIST :
i
Deschideti GameMode-ul dvs. si la inceput scrieti :
- Cod:
new afk[MAX_PLAYERS];
Dati FIND si scrieti in casuta aceea OnPlayerConnect(playerid)
Si dedesupt puneti :
- Cod:
afk[playerid] = 0
Dati din nou FIND si in casuta aceea scrieti OnPlayerCommand
Aici trebuie sa adaugam trei comenzi
AFK :
- Cod:
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;
}
BACK :
- Cod:
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;
}
AFKLIST :
i
- Cod:
f (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;
}
xXAlexutzXx- Newbie
- Mesaje : 2
Reputatie : 0
Data de inscriere : 26/02/2012
Pagina 1 din 1
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum
|
|