A Little Help
#9

Here is the code of afk replace it i fixed it
pawn Код:
if(strcmp("/afk",cmd,true) == 0)
{
    new tmp[256], cmd[128];
    new string[256], index;
    tmp = strtok(cmdtext,index);
    if(afk[playerid] == 0)
    {
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,COLOR_RED,"Usage:/afk[reason]");
            return 1;
        }
        afk[playerid] = 1;
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "WARNING->%s Is AFK [Reason->%s]<-WARNING", playername,tmp);
        SendClientMessageToAll(COLOR_YELLOW, string);
        TogglePlayerControllable(playerid,0);
    }
    else
    {
        afk[playerid] = 0;
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "->%s Is Back On Keyboard<-", playername);
        SendClientMessageToAll(COLOR_YELLOW, string);
        TogglePlayerControllable(playerid,1);
        SetPlayerHealth(playerid,100);
    }
    return 1;
}
Here is strtok function add it any where in script but not in cmds
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
+REP if i helped so
Reply


Messages In This Thread
A Little Help - by Littlehelper - 02.01.2012, 15:32
Re: A Little Help - by Danyal - 02.01.2012, 15:36
Re: A Little Help - by Mokerr - 02.01.2012, 15:41
Re: A Little Help - by Konstantinos - 02.01.2012, 15:41
Re: A Little Help - by Littlehelper - 02.01.2012, 15:42
Re: A Little Help - by Littlehelper - 02.01.2012, 15:49
Re: A Little Help - by Danyal - 02.01.2012, 15:51
Re: A Little Help - by Littlehelper - 02.01.2012, 15:56
Re: A Little Help - by Danyal - 02.01.2012, 16:01
Re: A Little Help - by Littlehelper - 02.01.2012, 16:06

Forum Jump:


Users browsing this thread: 4 Guest(s)