A ban command for Y_INI
#1

I need a ban IP for Y_INI command.
pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pScore,
    pAdmin,
    pHeals,
    pKills,
    pDeaths,
    pNameBanned,
    pIPBanned
}

dcmd_ban(playerid,params[])
{
    new string[128];
    new ID;
    new cmdreason[100];
    new pname[MAX_PLAYER_NAME];
    new tname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    GetPlayerName(ID,tname,sizeof(tname));
    if(sscanf(params,"us[100]",ID,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"[USAGE] /Ban (Player Name/ID) (Reason)");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"[ERROR] The player ID you entered is not connected to the server.");
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    format(string, sizeof(string), "~r~BANNED!");
    GameTextForPlayer(ID, string, 3000, 1);

    format(string,sizeof(string),"[BANNED] An Administrator has banned you from the server. [Reason: %s]",cmdreason);
    SendClientMessage(ID,COLOR_RED,string);

    format(string,sizeof(string),"[ADMIN BAN] Administrator has banned %s(%d). [Reason: %s]",tname,ID,cmdreason);
    SendClientMessageToAll(COLOR_PINK,string);

    format(string,sizeof(string),"9[ADMIN BANNED] Administrator has kicked banned. [Reason: %s]",tname,ID,cmdreason);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);

    format(string,sizeof(string),"[ADMIN RADIO] Administrator %s(%d) has banned %s(%d). [Reason: %s]",pname,playerid,tname,ID,cmdreason);
    SendAdminMessage(COLOR_PINK,string);
    IRC_GroupSay(gGroupID,IRC_ADMINCHANNEL,string);
   
    PlayerInfo[ID][pNameBanned] = PlayerInfo[ID][pNameBanned] =1;
    PlayerInfo[ID][pIPBanned] = PlayerInfo[ID][pIPBanned] =1;
    SetTimerEx("KickPlayer",1000,false,"i",ID);
    return 1;
}
Please if anyone could help me doing it with saving the reason..
Reply
#2

What u mean ? accounts not saving ? admin system ?
Reply
#3

INI_WriteString
Reply
#4

DobbysGamertag, Can you give me an example?
Reply
#5

pawn Код:
COMMAND:ban(playerid,params[])
{
    new reason,string[124];
    //other stuff
    format(string,sizeof(string),"%s",reason);
   INI_WriteString(filenamehere,"Ban Reason",string);
}
That should write into file with a reason. I've put filenamehere as that because i use

pawn Код:
new INI:file = INI_Open(Path(playerid));
So it'll write into my player files as

pawn Код:
COMMAND:ban(playerid,params[])
{
    new reason,string[124];
    //other stuff
    format(string,sizeof(string),"%s",reason);
    new INI:file = INI_Open(Path(playerid));
    INI_WriteString(file,"Ban Reason",string);
    INI_Close(file)
}
Or you can be lazy and write it to a log. You can then look through logs and see sorry if it seems messy. I can't script from the reply box :P
Reply
#6

Didn't get it enough, someone?
Reply
#7

Sorry for bumping so early, I just need it soon
Reply
#8

You're requesting a script, therefore you are posting in the wrong section.
This section is for help only, if you want to request a script, post here:
https://sampforum.blast.hk/showthread.php?tid=413556

Kind regards,
Mike Peterson
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)