Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- // Some news for the name changes
- new names[24], string[128];
- new PlayerText3D:afktext;
- new IsAfk[MAX_PLAYERS];
- // End of the news.
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Script created by Private200");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerName(playerid, names, sizeof(names));
- if (strcmp("/afk", cmdtext, true, 10) == 0)
- {
- if(IsAfk[playerid]) return SendClientMessage(playerid, 0xADD8E6FF, "You're already in AFK mode.");
- IsAfk[playerid] = 1;
- TogglePlayerControllable(playerid, 0);
- format(string,sizeof(string),"%s {FFFFFF} is now in AFK mode.", names);
- SendClientMessageToAll(0xADD8E6FF, string);
- GetPlayerPos(playerid, X, Y, Z);
- afktext = CreatePlayer3DTextLabel(playerid,"{FF0000}Player is in AFK mode.",0x008080FF, X,Y,Z,40.0);
- return 1;
- }
- if (strcmp("/back", cmdtext, true, 10) == 0)
- {
- if(IsAfk[playerid] == 1)
- {
- Afk_Back(playerid);
- }
- else
- SendClientMessage(playerid, 0xADD8E6FF, "You're not in AFK mode.");
- return 1;
- }
- return 0;
- }
- /*public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(IsAfk[playerid] == 1)
- {
- Afk_Back(playerid);
- }
- else
- SendClientMessage(playerid, 0xADD8E6FF, "You're not in AFK mode.");
- return 1;
- }*/
- public OnPlayerText(playerid,text[])
- {
- if(IsAfk[playerid] == 1)
- {
- Afk_Back(playerid);
- }
- else
- SendClientMessage(playerid, 0xADD8E6FF, "You're not in AFK mode.");
- return 1;
- }
- stock Afk_Back(playerid)
- {
- IsAfk[playerid] = 0;
- TogglePlayerControllable(playerid, 1);
- format(string,sizeof(string),"%s {FFFFFF} is now BACK from AFK mode.", names);
- SendClientMessageToAll(0xADD8E6FF, string);
- DeletePlayer3DTextLabel(playerid, afktext);
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- new OtherPlayerName[24], OtherPlayer;
- GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
- if(IsAfk[clickedplayerid] == 1)
- {
- format(string, 128, "%s {FFFFFF}is in AFK mode.", OtherPlayerName);
- SendClientMessage(playerid, 0xADD8E6FF, string);
- }
- else
- format(string, 128, "%s {FFFFFF}is not in AFK mode.", OtherPlayerName);
- SendClientMessage(playerid, 0xADD8E6FF, string);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement