05.10.2012, 06:05
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;
}