Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- **** AFK System - UberEverywhere ****
- */
- #define FILTERSCRIPT
- #include <a_samp>
- new AFK[MAX_PLAYERS];
- new OldSkin[MAX_PLAYERS];
- new OldCol[MAX_PLAYERS];
- new PlayerText:Afk[MAX_PLAYERS];
- new PlayerText:Back[MAX_PLAYERS];
- new PlayerText3D:afk[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print(" ._._._._._._._._._._._._._._._._._.");
- print(" AFK System by UberEverywhere loaded");
- print(" .-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- AFK[playerid] = 0;
- Afk[playerid] = CreatePlayerTextDraw(playerid, 257.000061, 192.074111, "~g~afk_~w~mode");
- PlayerTextDrawLetterSize(playerid, Afk[playerid], 0.786000, 3.184592);
- PlayerTextDrawAlignment(playerid, Afk[playerid], 1);
- PlayerTextDrawColor(playerid, Afk[playerid], -1);
- PlayerTextDrawSetShadow(playerid, Afk[playerid], 0);
- PlayerTextDrawSetOutline(playerid, Afk[playerid], 1);
- PlayerTextDrawBackgroundColor(playerid, Afk[playerid], 255);
- PlayerTextDrawFont(playerid, Afk[playerid], 3);
- PlayerTextDrawSetProportional(playerid, Afk[playerid], 1);
- PlayerTextDrawSetShadow(playerid, Afk[playerid], 0);
- Back[playerid] = CreatePlayerTextDraw(playerid, 123.000091, 219.037048, "type_~r~/back_~w~to_leave_afk_mode");
- PlayerTextDrawLetterSize(playerid, Back[playerid], 0.786000, 3.184592);
- PlayerTextDrawAlignment(playerid, Back[playerid], 1);
- PlayerTextDrawColor(playerid, Back[playerid], -1);
- PlayerTextDrawSetShadow(playerid, Back[playerid], 0);
- PlayerTextDrawSetOutline(playerid, Back[playerid], 1);
- PlayerTextDrawBackgroundColor(playerid, Back[playerid], 255);
- PlayerTextDrawFont(playerid, Back[playerid], 3);
- PlayerTextDrawSetProportional(playerid, Back[playerid], 1);
- PlayerTextDrawSetShadow(playerid, Back[playerid], 0);
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- AFK[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new pname[24], str[128];
- GetPlayerName(playerid, pname, 24);
- if(!strcmp(cmdtext, "/afk", true))
- {
- if(AFK[playerid] == 1)
- {
- SendClientMessage(playerid, -1, "{FF0000}ERROR:{FFFFFF} You are already AFK! Type /back to get back from AFK");
- return 1;
- }
- SendClientMessage(playerid, 0x74FF00AA, "You are now AFK! Type /back to get back from AFK");
- format(str, sizeof(str), "%s [%d] is now {74FF00}AFK{FFFFFF}!", pname, playerid);
- SendClientMessageToAll(-1, str);
- OldSkin[playerid] = GetPlayerSkin(playerid);
- OldCol[playerid] = GetPlayerColor(playerid);
- SetPlayerHealth(playerid, 99999999);
- SetPlayerColor(playerid, 0xF4F800AA);
- afk[playerid] = CreatePlayer3DTextLabel(playerid, "AFK", 0x74FF00AA, 30.0, 40.0, 50.0, 40.0, 0);
- Attach3DTextLabelToPlayer(Text3D:afk[playerid], playerid, 0.0, 0.0, 0.3);
- PlayerTextDrawShow(playerid, Afk[playerid]);
- PlayerTextDrawShow(playerid, Back[playerid]);
- SetPlayerSkin(playerid, 0);
- TogglePlayerControllable(playerid, 0);
- AFK[playerid] = 1;
- return 1;
- }
- if(!strcmp(cmdtext, "/back", true))
- {
- if(AFK[playerid] == 0)
- {
- SendClientMessage(playerid, -1, "{FF0000}ERROR:{FFFFFF} You are not AFK! Type /afk to go AFK");
- return 1;
- }
- SendClientMessage(playerid, -1, "Welcome back :)");
- TogglePlayerControllable(playerid, 1);
- format(str, sizeof(str), "%s [%d] is now back from {74FF00}AFK{FFFFFF}!", pname, playerid);
- SendClientMessageToAll(-1, str);
- SetPlayerHealth(playerid, 100);
- SetPlayerColor(playerid, OldCol[playerid]);
- SetPlayerSkin(playerid, OldSkin[playerid]);
- DeletePlayer3DTextLabel(playerid, afk[playerid]);
- PlayerTextDrawHide(playerid, Afk[playerid]);
- PlayerTextDrawHide(playerid, Back[playerid]);
- AFK[playerid] = 0;
- return 1;
- }
- return 0;
- }
- public OnPlayerText(playerid, text[])
- {
- if(AFK[playerid] == 1)
- {
- SendClientMessage(playerid, -1, "{FF0000}ERROR:{FFFFFF} You are AFK. Type /back to talk again.");
- return 0;
- }
- return 1;
- }
- public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
- {
- if(AFK[damagedid] == 1)
- {
- GameTextForPlayer(playerid, "~R~player is ~n~afk", 3000, 3);
- return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement