Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* [iPs] AFK Advanced System (:
- Criador Geral: [iPs]DiogoBras
- Agradecimentos; Fórum samp - Andei a pesquisar uns tópicos de galera pedindo, e decidi fazer :D
- Comandos: /ausente ; /online ; /Lista
- Funcionalidades:
- /ausente - O jogador fica com a tag "[AFK]" antes do nick, ficando [AFK]NOME! É setado para o mundo virtual nº1, para não ter contato com os outros jogadores e também é congelado.
- /onlline - O jogador fica com o nome normal, sem a tag "[AFK]"! É denovo setado para o mundo virtual nº0 (normal), e é descongelado.
- /Lista - Mostra o nome de todos os jogadores que estão ausentes, e quando eles voltam (/online) o nome deles desaparece da lista quando digitado o comando. */
- #include <a_samp>
- // »Defines das Cores«
- #define Amarelo 0xEEAD0EFF
- #define Laranja 0xFF7F00FF
- #define Vermelho 0xEE0000FF
- // »Variáveis«
- new AFK[MAX_PLAYERS], Jogador[MAX_PLAYER_NAME], string[56], NomeTemporario[MAX_PLAYER_NAME];
- public OnPlayerConnect(playerid)
- {
- AFK[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/ausente", true) == 0)
- {
- if(AFK[playerid] == 0)
- {
- GetPlayerName(playerid, NomeTemporario, sizeof(NomeTemporario));
- SetPVarString(playerid, "NomeOriginal", NomeTemporario);
- format(NomeTemporario, sizeof(NomeTemporario), "[AFK]%s", NomeTemporario);
- SetPlayerName(playerid, NomeTemporario);
- SetPlayerArmour(playerid, 99999);
- TogglePlayerControllable(playerid, 0);
- GetPayerName(playerid, Jogador, sizeof(Jogador));
- format(string, sizeof(string), "|AFK| Jogador(a) %s está ausente! (/ausente).", Jogador);
- SendClientMessageToAll(Amarelo, string);
- AFK[playerid] = 1;
- return SetPlayerVirtualWorld(playerid, 1);
- }
- else return SendClientMessage(playerid, Laranja, "|AFK| Você já está ausente! Use (/online) para voltar ao servidor.");
- }
- if(strcmp(cmdtext, "/online", true) == 0)
- {
- if(AFK[playerid] == 1)
- {
- GetPVarString(playerid, "NomeOriginal", NomeTemporario, sizeof(NomeTemporario));
- SetPlayerName(playerid, NomeTemporario);
- DeletePVar(playerid, "NomeOriginal");
- SetPlayerArmour(playerid, 0);
- TogglePlayerControllable(playerid, 1);
- GetPlayerName(playerid, Jogador, sizeof(Jogador));
- format(string, sizeof(string), "|AFK| Jogador(a) %s está voltou ao jogo! (/online).", Jogador);
- SendClientMessageToAll(Amarelo, string);
- AFK[playerid]=0;
- return SetPlayerVirtualWorld(playerid, 0);
- }
- else return SendClientMessage(playerid, Laranja, "|AFK| Você já está online!");
- }
- if(strcmp(cmdtext, "/Lista", true) == 0)
- {
- SendClientMessage(playerid, Laranja, "|AFK| Jogadores Ausentes:");
- for(new j = 0; j < MAX_PLAYERS; j++)
- {
- if(IsPlayerConnected(j))
- {
- if(AFK[j] == 1)
- {
- GetPlayerName(j, Jogador, sizeof(Jogador));
- format(string, sizeof(string),"Jogador %s | ID: %i", Jogador, j);
- SendClientMessage(playerid, Amarelo, string);
- }
- }
- }
- return 1;
- }
- return SendClientMessage(playerid, Vermelho, "Comando inválido!");
- }
Advertisement
Add Comment
Please, Sign In to add comment