Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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
- #pragma tabsize 0
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_GREEN 0x00FF00AA
- #define COLOR_RED 0xFF0000AA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_YELLOW 0xFFFF00AA
- enum Player
- {
- AFKstatus
- }
- new PlayerInfo[MAX_PLAYERS][Player];
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- dcmd_afk(playerid, params[])
- {
- #pragma unused params
- new string[256];
- if (PlayerInfo[playerid][AFKstatus] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "ERROR: You are all ready AFK!");
- return 1;
- }
- else if (PlayerInfo[playerid][AFKstatus] == 0)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(string, sizeof(string), "%s (ID:%d) Is away from the keyboard!", pname,playerid);
- SendClientMessageToAll(COLOR_YELLOW, string);
- TogglePlayerControllable(playerid,0);
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
- PlayerInfo[playerid][AFKstatus] = 1;
- return 1;
- }
- return 0;
- }
- dcmd_back(playerid, params[])
- {
- #pragma unused params
- new string[256];
- if (PlayerInfo[playerid][AFKstatus] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "ERROR: You are all ready BACK!");
- return 1;
- }
- else if (PlayerInfo[playerid][AFKstatus] == 0)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(string, sizeof(string), "%s (ID:%d) Writing aigan keyboard", pname,playerid);
- SendClientMessageToAll(COLOR_GREEN, string);
- TogglePlayerControllable(playerid,0);
- SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
- PlayerInfo[playerid][AFKstatus] = 1;
- return 1;
- }
- return 0;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayerInfo[playerid][AFKstatus] = 0;
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if (PlayerInfo[playerid][AFKstatus] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "Dude!! use /back to speak!");
- return 0;
- }
- else if (PlayerInfo[playerid][AFKstatus] == 0)
- {
- return 1;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(afk,3,cmdtext);
- dcmd(back,3,cmdtext);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement