Anyone no a link for an afk system
#1

Tittle says all

btw i've searched but haven't found any.
Reply
#2

Lol, there are tons of them...
http://forum.sa-mp.com/showthread.ph...ghlight=System
Reply
#3

Quote:
Originally Posted by ikarus
Посмотреть сообщение
hehe thanks m8


EDIT: Okay but i need one that sets the players name with a [AFK] tag

And removes it when hes back
Reply
#4

Here since im really bored, I made you one :
pawn Код:
#include <a_samp>

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define Red 0xFF0000FF
#define Grey 0xAFAFAFAA
#define Green 0x33AA33AA
#define Yellow 0xFFFF00AA
#define White 0xFFFFFFAA
#define Blue 0x0000BBAA
#define Lightblue 0x33CCFFAA
#define Orange 0xFF9900AA
#define Lime 0x10F441AA
#define Maroon 0x800000AA
#define Navy 0x000080AA
#define Aqua 0xF0F8FFAA
#define Crimson 0xDC143CAA
#define Black 0x000000AA
#define Brown 0XA52A2AAA
#define Gold 0xB8860BAA
#define Limegreen 0x32CD32AA

new AFKs[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(afk,3,cmdtext);
  dcmd(back,4,cmdtext);
  return 1;
}

dcmd_afk(playerid, params[])
{
  new name[MAX_PLAYER_NAME], string[126];
  GetPlayerName(playerid, name, sizeof(name));
  SetPVarString(playerid, "AFKName", name);
  format(string, sizeof(string), "[AFK]%s", name);
  SetPlayerName(playerid, string);
  format(string, sizeof(string), "SERVER : %s is now Away from the keyboard! (AFK)", name);
  SendClientMessageToAll(Lightblue, string);
  SendClientMessage(playerid, Red, "SERVER : You are now AFK! Do /back if you are not AFK anymore!");
  TogglePlayerControllable(playerid, 0);
  SetPlayerVirtualWorld(playerid, 1);
  AFKs[playerid] = 1;
  return 1;
}

dcmd_back(playerid, params[])
{
  new name[MAX_PLAYER_NAME], string[126];
  GetPlayerName(playerid, name, sizeof(name));
  if(AFKs[playerid] == 0) return SendClientMessage(playerid, Red, "ERROR : You are not AFK!");
  AFKs[playerid] = 0;
  TogglePlayerControllable(playerid, 1);
  SetPlayerVirtualWorld(playerid, 0);
  GetPVarString(playerid, "AFKName", name, sizeof(name));
  SetPlayerName(playerid, name);
  format(string, sizeof(string), "SERVER : %s is now back!", name);
  SendClientMessageToAll(Lightblue, string);
  GameTextForPlayer(playerid, "WELCOME BACK!", 2500, 3);
  return 1;
}
PS : If it has some bugs, just PM me.
Reply
#5

Quote:
Originally Posted by ViruZZzZ_ChiLLL
Посмотреть сообщение
Here since im really bored, I made you one :
pawn Код:
#include <a_samp>

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define Red 0xFF0000FF
#define Grey 0xAFAFAFAA
#define Green 0x33AA33AA
#define Yellow 0xFFFF00AA
#define White 0xFFFFFFAA
#define Blue 0x0000BBAA
#define Lightblue 0x33CCFFAA
#define Orange 0xFF9900AA
#define Lime 0x10F441AA
#define Maroon 0x800000AA
#define Navy 0x000080AA
#define Aqua 0xF0F8FFAA
#define Crimson 0xDC143CAA
#define Black 0x000000AA
#define Brown 0XA52A2AAA
#define Gold 0xB8860BAA
#define Limegreen 0x32CD32AA

new AFKs[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(afk,3,cmdtext);
  dcmd(back,4,cmdtext);
  return 1;
}

dcmd_afk(playerid, params[])
{
  new name[MAX_PLAYER_NAME], string[126];
  GetPlayerName(playerid, name, sizeof(name));
  SetPVarString(playerid, "AFKName", name);
  format(string, sizeof(string), "[AFK]%s", name);
  SetPlayerName(playerid, string);
  format(string, sizeof(string), "SERVER : %s is now Away from the keyboard! (AFK)", name);
  SendClientMessageToAll(Lightblue, string);
  SendClientMessage(playerid, Red, "SERVER : You are now AFK! Do /back if you are not AFK anymore!");
  TogglePlayerControllable(playerid, 0);
  SetPlayerVirtualWorld(playerid, 1);
  AFKs[playerid] = 1;
  return 1;
}

dcmd_back(playerid, params[])
{
  new name[MAX_PLAYER_NAME], string[126];
  GetPlayerName(playerid, name, sizeof(name));
  if(AFKs[playerid] == 0) return SendClientMessage(playerid, Red, "ERROR : You are not AFK!");
  AFKs[playerid] = 0;
  TogglePlayerControllable(playerid, 1);
  SetPlayerVirtualWorld(playerid, 0);
  GetPVarString(playerid, "AFKName", name, sizeof(name));
  SetPlayerName(playerid, name);
  format(string, sizeof(string), "SERVER : %s is now back!", name);
  SendClientMessageToAll(Lightblue, string);
  GameTextForPlayer(playerid, "WELCOME BACK!", 2500, 3);
  return 1;
}
PS : If it has some bugs, just PM me.
Thanks thats very kind of you but i'm using 0.2x
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)