Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===< _Maoriko_ AFK System >===//
- //===< includes >===//
- #include <a_samp>
- //===< defines >===//
- #define SendFormatMessage(%0,%1,%2,%3) format(String, sizeof(String),%2,%3) && SendClientMessage(%0, %1, String)
- #define SendFormatMessageToAll(%0,%1,%2) format(String, sizeof(String),%1,%2) && SendClientMessageToAll(%0, String)
- //===< enums >===//
- enum AfkInfo
- {
- pName[MAX_PLAYER_NAME],
- bool:InAFK
- };
- //===< news >===//
- new aInfo[MAX_PLAYERS][AfkInfo];
- new String[128];
- public OnPlayerConnect(playerid) return GetPlayerName(playerid, aInfo[playerid][pName], MAX_PLAYER_NAME);
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/AFK", true))
- {
- if(aInfo[playerid][InAFK] == true)
- {
- aInfo[playerid][InAFK] = false;
- SendClientMessage(playerid, -1, "{FF0000}[AFK-System] {FFFFFF}You went AFK mode successfully");
- SendFormatMessageToAll(-1, "{FF0000}[AFK-System] {FFFFFF}The player %s successfully returned from AFK Mode", aInfo[playerid][pName]);
- TogglePlayerControllable(playerid, true);
- return true;
- }
- else
- {
- aInfo[playerid][InAFK] = true;
- SendClientMessage(playerid, -1, "{FF0000}[AFK-System] {FFFFFF}AFK successfully enters");
- SendFormatMessageToAll(-1, "{FF0000}[AFK-System] {FFFFFF}The player %s enters AFK Mode", aInfo[playerid][pName]);
- TogglePlayerControllable(playerid, false);
- }
- return true;
- }
- if(aInfo[playerid][InAFK] == true) return SendClientMessage(playerid, -1, "{FF0000}[AFK-System] {FFFFFF}You can't type commands when you in AFK Mode");
- if(!strcmp(cmdtext, "/AFKList", true))
- {
- new AFKCount;
- for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && aInfo[i][InAFK] == true)
- {
- AFKCount++;
- SendClientMessage(playerid, -1, "{FF0000}[AFK-System] {FFFFFF}Players in AFK Mode List");
- SendFormatMessage(playerid, -1, "{FF0000}[AFK-System] {FFFFFF}>> {FF0000}%s {FFFFFF}[ID: %d]", aInfo[i][pName], i);
- }
- if(AFKCount == 0) return SendClientMessage(playerid, -1, "{FF0000}[AFK-System] {FFFFFF}There is no players in AFK Mode");
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment