28.08.2010, 21:47
(
Последний раз редактировалось ipsBruno; 28.08.2010 в 22:22.
)
Por DraKoN
Este sistema armazena os Nicks usados por o Protelo da Internet (IP), ao armazenar ele terб a Opзгo de leitura bom para pegar Players jб banidos ou atй alguns que se passam por Fakes
Comando:
• /fake -> Comando usado para ler os Fakes
Cуdigo:
pawn Код:
#include <a_samp>
#define CMD:(%1) if(!strcmp(cmd,%1, true))
#define UsarProcessador new cmd[128],idx;cmd = Processar(cmdtext, idx);
#define UsarParametros new tmp[128],idxp;tmp = Processar(cmdtext, idxp);
Processar(const s[], &i)
{
new l = strlen(s);while ((i < l) && (s[i] <= ' ')) {
i++;
}
new o = i;new r[20];while ((i < l) && (s[i] > ' ') && ((i - o) < (sizeof(r) - 1))) {
r[i - o] = s[i];i++;
}r[i - o] = EOS; return r;
}
public OnPlayerConnect(playerid)
{
InserirFake(playerid);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
UsarProcessador
CMD:("/fakes") {
UsarParametros
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,0x08005,"O Player Esta OFF-LINE");
if(!strlen(tmp)) return SendClientMessage(playerid,0x08005,"Digite /fakes [id]");
if(strval(tmp) == playerid) return SendClientMessage(playerid,0x08005,"Nгo pode usar esse comando em si mesmo");
LeituraFakes(strval(tmp),playerid);
return 1;
}
return 0;
}
stock LeituraFakes(playerid,other)
{
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
new string[255];
new ip[25];
format(ip, sizeof(ip), "Fakes/%s.ini",plrIP);
new File:arquivo=fopen(ip,io_read);
SendClientMessage(other,0xFFFFFFFF,"> Lista de Fakes do Player <");
while(fread(arquivo,string)) {
SendClientMessage(other,0xFFFFFFFF,string);
}
fclose(arquivo);
}
stock InserirFake(playerid)
{
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
new ip[25];
format(ip, sizeof(ip), "Fakes/%s.ini",plrIP);
if(!fexist(ip)) {
new File:Temp;
Temp = fopen(ip,io_write);
fclose(Temp);
}
if(fexist(ip)) {
new
File:file,
bool:Existe = false,
string[128],
NCK[MAX_PLAYER_NAME],
str[32];
GetPlayerName(playerid, NCK, sizeof(NCK));
format(str, sizeof(str), "%s,", NCK);
file = fopen(ip, io_read);
while(fread(file, string)) {
if(strfind(string, str, true) == 0) {
Existe = true;
}
}
fclose(file);
if(Existe == false) {
file = fopen(ip, io_append);
format(string, sizeof(string), "%s,", NCK);
fwrite(file, string);
fclose(file);
Existe = false;
}
}
}