29.08.2010, 17:15
(
Последний раз редактировалось ipsBruno; 09.12.2012 в 00:58.
)
Por Bruno da Silva
Introduction:
This save in file the nicks used by players in one your IP (internet protocol)
Command:
• /fake [playerid] > reading Fakes of Players
CODE:
pawn Код:
#include <a_samp>
#define CMD:(%1) if(!strcmp(cmd,%1, true))
#define UsingProcessing new cmd[128],idx;cmd = Process(cmdtext, idx);
#define UsingParams new tmp[128],idxp;tmp = Process(cmdtext, idxp);
Process(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[])
{
UsingProcessing
CMD:("/fake") {
UsingParams
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,"Your Self NO");
ReadingFakes(strval(tmp),playerid);
return 1;
}
return 0;
}
stock ReadingFakes(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,"> List of Fakes of 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;
}
}
}
Obs: Create the folder Fakes in Scriptfiles
CREDITS FOR TORIBIO AND DRAKON