/afk thingy
#3

Quote:
Originally Posted by ColdIce
Посмотреть сообщение
I got /afk system.
pawn Код:
#include <a_samp>
#if defined FILTERSCRIPT
#endif
new afk[MAX_PLAYERS];
new Float:x;
new Float:y;
new Float:z;
new cage;
new cage1;
new cage2;
new cage3;
new cage4;
new muted[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/afk", cmdtext, true, 10) == 0)
    {
        if (afk[playerid] == 0)
        {
        GetPlayerPos(playerid, x, y, z);
        muted[playerid] = 1;
        SetPlayerHealth(playerid, 100000000000);
        new name[MAX_PLAYER_NAME], string[44];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s is AFK.",name);
        SendClientMessageToAll(0xFFFF00AA, string);
        afk[playerid] = 1;
        SetPlayerPos(playerid, 2261.4995, 1398.8009, 30.1234);
        new Float:xi = 2261.4995;
        new Float:yi = 1398.8009;
        new Float:zi = 30.1234;
        cage = CreateObject(985, xi, yi+4, zi, 0.0, 0.0, 0.0);
        cage2 = CreateObject(985, xi+4, yi, zi, 0.0, 0.0, 90.0);
        cage3 = CreateObject(985, xi-4, yi, zi, 0.0, 0.0, 270.0);
        cage4 = CreateObject(985, xi, yi-4, zi, 0.0, 0.0, 180.0);
        }
        else
        {
        SendClientMessage(playerid, 0xFFFF00AA,"You are already AFK!");
        }
        return 1;
    }
   
    if (strcmp("/back", cmdtext, true, 10) == 0)
    {
        if (afk[playerid] == 1)
        {
        SetPlayerHealth(playerid, 100);
        new name[MAX_PLAYER_NAME], string[44];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s is BACK.",name);
        SendClientMessageToAll(0xFFFF00AA, string);
        afk[playerid] = 0;
        SetPlayerPos(playerid, x, y, z);
        DestroyObject(cage);
        DestroyObject(cage1);
        DestroyObject(cage2);
        DestroyObject(cage3);
        DestroyObject(cage4);
        muted[playerid] = 0;
        }
        else
        {
        SendClientMessage(playerid, 0xFFFF00AA, "You arent AFK!");
        }
        return 1;
    }
    return 0;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    afk[playerid] = 0;
    return 1;
}

public OnPlayerText(playerid, text[])
{
    if (muted[playerid] == 1)
    {
        SendClientMessage(playerid, 0xFFFF00AA, "YOU CANNOT TALK WHILE AFK!");
        return 0;
    }
    return 1;
}
How to add [AFK] in front of players name? Like when they do /afk they will appear in player list/and above them, for example [AFK]ColdIce, and when they do /back the AFK thingy goes away
just Create a Simple /afk and /back command Which will Announce To All People That %s @PLAYER@ Is Afk. Also Use a Create3dTextlabel, That Will Show that The Player Is Afk.
Also Use a Textdraw instead of Making a Cage, Good Example : /afk "Player Gets Blind" "His Virtual World is 1"
If you use
pawn Код:
Toggleplayercontrollable(playerid,0);
in /afk. and
pawn Код:
Toggleplayercontrollable(playerid,1);
in /back. Than Theres No Use For Admins /Freeze command.

ADVICED :LD
Reply


Messages In This Thread
/afk thingy - by ColdIce - 11.06.2011, 17:14
Re: /afk thingy - by HP - 11.06.2011, 17:52
Re: /afk thingy - by 0_o - 11.06.2011, 17:56
Re: /afk thingy - by ColdIce - 11.06.2011, 18:27
Re: /afk thingy - by HP - 11.06.2011, 18:29
Re: /afk thingy - by ColdIce - 11.06.2011, 18:36
Re: /afk thingy - by HP - 11.06.2011, 18:43
Re: /afk thingy - by ColdIce - 11.06.2011, 19:00
Re: /afk thingy - by HP - 11.06.2011, 19:30
Re: /afk thingy - by alpha500delta - 11.06.2011, 19:47

Forum Jump:


Users browsing this thread: 2 Guest(s)