Help with ban system.
#4

I did it for you .


pawn Код:
//Put in the OnPlayerCommandText callback:

if(!strcmp("/ban",cmdtext,true,4))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFAA,"Only RCON Admins can use the /ban command.");
        new focus1[4], focus2[128], text[128], NickName1[MAX_PLAYER_NAME], NickName2[MAX_PLAYER_NAME];
        strcat(focus1, KcmD(1, cmdtext));
        focus2 = KcmD(2, cmdtext);
        if(!strlen(focus1)) return SendClientMessage(playerid, 0xFFFFFFAA,"Type: /ban [id] [reason]");
        if(!strlen(focus2)) focus2 = "no reason";
        GetPlayerName(playerid, NickName1, MAX_PLAYER_NAME);
        GetPlayerName(strval(focus1), NickName2, MAX_PLAYER_NAME);
        format(text,128,"[Admin] %s was banned by the admin %s. Reason: %s.",NickName1, NickName2, focus2);
        SendClientMessageToAll(0x33CCFFAA,text);
        Ban(strval(focus1));
        return true;
    }



//And, put in the end of your GameMode:

stock KcmD(param, cmdtext[])
{
    new string[128], pos, var;
    format(string, sizeof(string), "%s ", cmdtext);

    while((pos = strfind(string, " ", true)) != -1)
    {
        if(var == param) return string;
        var++;

        strdel(string, 0, pos + 1);
        if(strcmp(string, " ", true, pos) == 0) goto end;
    }

end:
    string[0] = '\0';
    return string;
}


I hope that i have helped .
Reply


Messages In This Thread
Help with ban system. - by budelis - 30.07.2011, 13:44
Re: Help with ban system. - by Runedog48 - 30.07.2011, 13:48
Re: Help with ban system. - by budelis - 30.07.2011, 14:07
Re: Help with ban system. - by rjjj - 30.07.2011, 14:58
Re: Help with ban system. - by [MWR]Blood - 30.07.2011, 15:48
Re: Help with ban system. - by budelis - 30.07.2011, 16:28
AW: Help with ban system. - by samtey - 30.07.2011, 17:36
Re: Help with ban system. - by HyperZ - 30.07.2011, 18:51
Re: Help with ban system. - by Rafa - 30.07.2011, 18:58
Re: Help with ban system. - by budelis - 30.07.2011, 20:56

Forum Jump:


Users browsing this thread: 1 Guest(s)