How to make /afk
#1

hy how i can make cmd /afk and /back how i can make when i write /afk my camerda has a slowli spin

bad english.. Sorry
Reply
#2

Search returned this (took me 2 seconds) -> https://sampforum.blast.hk/showthread.php?tid=204575
Reply
#3

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Search returned this (took me 2 seconds) -> https://sampforum.blast.hk/showthread.php?tid=204575
i dont understant bad english
Reply
#4

Here's a little and simple code.

At the top of your script:
pawn Код:
new IsPlayerAFK[MAX_PLAYERS];
Under OnPlayerConnect(playerid)
pawn Код:
IsPlayerAFK[playerid] = 0;
Under OnPlayerCommandText(playerid, cmdtext[])
pawn Код:
new string[128], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp("/afk", cmdtext, true, 4) == 0)
{
    if(!IsPlayerAFK[playerid])
    {
        format(string, sizeof(string), "** [ID: %d] %s is now AFK.",playerid,PlayerName);
        SendClientMessageToAll(0xFFFFFFAA, string);
        TogglePlayerControllable(playerid,0);
        IsPlayerAFK[playerid] = 1;
    }
    else
    {
        format(string, sizeof(string), "** [ID: %d] %s is no longer AFK.",playerid,PlayerName);
        SendClientMessageToAll(0xFFFFFFAA, string);
        TogglePlayerControllable(playerid,1);
        IsPlayerAFK[playerid] = 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)