[Pedido] Modo de banir um player;
#4

Fiz rбpidin aqui, bem simples, mas й oque vocк quer (Nгo testei, mas tenho certeza que vai funcionar).
pawn Код:
#include <a_samp>
#define FILTERSCRIPT
#include <sscanf>
#include <zcmd>
#include <DOF2>

new CheckBan[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" [FS] Ban");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    DOF2_Exit();
    return 1;
}

public OnPlayerConnect(playerid)
{
    CarregarCheckBan(playerid);
    if(CheckBan[playerid] == 1)
    {
        new bString[128], bName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, bName, MAX_PLAYER_NAME);
        format(bString, sizeof(bString), "Olб %s, desculpe, mas sua conta estб banida e vocк nгo poderб entrar neste sevidor!", bName);
        SendClientMessage(playerid, -1, bString);
        Kick(playerid);
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    SalvarCheckBan(playerid);
    return 1;
}

public OnPlayerUpdate(playerid)
{
    SalvarCheckBan(playerid);
    return 1;
}

CMD:banir(playerid, params[])
{
    new bID;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nгo tem permissгo!");
    if(sscanf(params, "u", bID)) return SendClientMessage(playerid, -1, "USE: /banir [ID]");
    if(!IsPlayerConnected(bID)) return SendClientMessage(playerid, -1, "Player nгo conectado!");
    CheckBan[bID] = 1;
    return 1;
}

stock SalvarCheckBan(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "Banidos/%s.ini", playername);
    if(DOF2_FileExists(arquivo))
    {
        DOF2_SetInt(arquivo, "Banido", CheckBan[playerid]);
    }
    else
    {
        DOF2_CreateFile(arquivo);
        DOF2_SetInt(arquivo, "Banido", CheckBan[playerid]);
    }
    return 1;
}

stock CarregarCheckBan(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "Banidos/%s.ini", playername);
    CheckBan[playerid] = DOF2_GetInt(arquivo, "Admin");
    return 1;
}
Reply


Messages In This Thread
Modo de banir um player; - by Ley - 04.10.2012, 23:55
Re: Modo de banir um player; - by Ley - 05.10.2012, 00:46
Re: Modo de banir um player; - by Maklister - 05.10.2012, 04:00
Re: Modo de banir um player; - by Rhayziin - 05.10.2012, 06:05
Re: Modo de banir um player; - by Jason` - 05.10.2012, 10:14
Re: Modo de banir um player; - by WeenSoares_ - 05.10.2012, 14:21
Re: Modo de banir um player; - by Ley - 05.10.2012, 15:22

Forum Jump:


Users browsing this thread: 1 Guest(s)