14.04.2013, 15:54
Since I haven't tested the code, I'm not sure if it will work. However try this:
pawn Код:
CheckName(teamname[], name[])
{
new string[20];
new destination[128];
format(destination, sizeof(destination), "fLogs/%s.fam.log", teamname);
new File: file = fopen(destination, io_read); // I'm not sure what's the name of the log file.
while(fread(file, string))
{
if (strcmp(name, string, true, strlen(name)) == 0)
{
fclose(file);
return 1;
}
}
fclose(file);
return 0;
}
RemoveName(teamname[], name[])
{
if(CheckName(teamname, name) == 1)
{
new string[20];
new destination[128];
format(destination, sizeof(destination), "fLogs/%s.fam.log", teamname);
new File: file = fopen(destination, io_read);
fcreate("TempFamLog.cfg");
new File: file2 = fopen("TempFamLog.cfg", io_append);
while(fread(file, string))
{
if (strcmp(name, string, true, strlen(name)) != 0 && strcmp("\n", string) != 0)
{
fwrite(file2, string);
}
}
fclose(file);
fclose(file2);
file = fopen(destination, io_write);
file2 = fopen("TempFamLog.cfg", io_read);
while(fread(file2, string))
{
fwrite(file, string);
}
fclose(file);
fclose(file2);
fremove("TempFamLog.cfg");
return 1;
}
return 0;
}
COMMAND:auninvite(playerid, params[])
{
if(GetAdminLevel(playerid) < 10) return SendClientError(playerid, CANT_USE_CMD);
new iPlayer;
if( sscanf ( params, "u", iPlayer)) return SCP(playerid, "[PlayerID/PartOfName]");
if(!IsPlayerConnected(iPlayer)) return SendClientError(playerid, PLAYER_NOT_FOUND);
new pname[24];
new dest[128];
GetPlayerName(iPlayer, pname, sizeof(pname));
RemoveName(PlayerInfo[iPlayer][PTeamName], pname);
Uninvite(iPlayer,GetPlayerFaction(iPlayer));
return 1;
}