Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *----------------^_^--------------*
- | |
- | AFK System |
- | |
- *----------------^_^--------------*
- */
- //------------------------------------------------------------------------------
- #include <a_samp>
- //------------------------------------------------------------------------------
- new Text3D: AFK[MAX_PLAYERS];
- new AFKS[MAX_PLAYERS];
- //------------------------------------------------------------------------------
- forward SetPlayerToTeamColor(playerid);
- forward OnPlayerConnect(playerid);
- //------------------------------------------------------------------------------
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_AFK 0x595858AA
- #define COLOR_LIGHTRED 0xFF6347AA
- #define COLOR_LIGHTGREEN 0x9ACD32AA
- //------------------------------------------------------------------------------
- public OnFilterScriptInit()
- {
- print("\n-----------------------------------------------------");
- print(" Advanced AFK System by Razvann was Loaded with succes!");
- print("-------------------------------------------------------\n");
- }
- public OnPlayerConnect(playerid)
- {
- AFKS[playerid] = 0;
- }
- //------------------------------------------------------------------------------
- public OnFilterScriptExit()
- {
- print("\n-------------------------------------------------------");
- print(" Advanced AFK System by Razvann was Unloaded with succes!");
- print("---------------------------------------------------------\n");
- }
- //------------------------------------------------------------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/afk", cmdtext, true) == 0)
- {
- AFKS[playerid] = 1;
- TogglePlayerControllable(playerid, 0);
- SendClientMessage(playerid, COLOR_WHITE, "You're now afk, type /back to be back!");
- AFK[playerid] = Create3DTextLabel("AFK",0x008080FF,0.0,0.0,0.0,20,0,1);
- Attach3DTextLabelToPlayer(AFK[playerid], playerid, 0.0, 0.0, -0.6);
- SetPlayerColor(playerid, COLOR_AFK);
- return 1;
- }
- if (strcmp("/back", cmdtext, true) == 0)
- {
- AFKS[playerid] = 0;
- TogglePlayerControllable(playerid, 1);
- SendClientMessage(playerid, COLOR_WHITE, "You're now back, type /afk to be AFK!");
- Delete3DTextLabel(Text3D:AFK[playerid]);
- SetPlayerToTeamColor(playerid);
- return 1;
- }
- if(strcmp("/afkhelp", cmdtext, true) == 0)
- {
- SendClientMessage(playerid, COLOR_WHITE, "** AFK ** /afk /back /afklist");
- return 1;
- }
- if(strcmp(cmdtext, "/afklist", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- new count = 0;
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "AFKS Online:");
- for(new i=0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(AFKS[i] == 1)
- {
- new string[256];
- new giveplayer[MAX_PLAYER_NAME];
- GetPlayerName(i, giveplayer, sizeof(giveplayer));
- format(string, sizeof(string), "[%d]%s", i,giveplayer);
- SendClientMessage(playerid,COLOR_WHITE,string);
- count++;
- }
- }
- }
- if(count == 0)
- {
- SendClientMessage(playerid,COLOR_LIGHTRED,"* Currently no AFKS online.");
- }
- }
- return 1;
- }
- return 0;
- }
- //------------------------------------------------------------------------------
- public SetPlayerToTeamColor(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- SetPlayerColor(playerid, COLOR_WHITE);
- }
- }
- //------------------------------------------------------------------------------
- /*
- *----------------^_^--------------*
- | |
- | AFK System |
- | |
- *----------------^_^--------------*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement