#1

hey guys ... i want a code that get the name of the kicked player and add the name into a file...
and after 1 week the file get cleared that means that all name will deleted after 1 week

can someone help me?
Reply
#2

Use this :

pawn Код:
forward KickLog(string[]);

public KickLog(string[])
{
    new entry[256];
    format(entry, sizeof(entry), "%s\n",string);
    new File:hFile;
    hFile = fopen("KickLog.txt", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}

// Put this in your /kick command
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
KickLog(string);
format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
Kick(giveplayerid);
Reply
#3

i have this
pawn Код:
GetPlayerWeaponData(i, 7, weapon, ammo);
    if(weapon == 38 && ammo >= 1)
    {
    format(string, sizeof(string), "[Anti Weapon]: %s (id:%d) was kicked cause he is a fucking CHEATER (Minigun) [Time: %02d:%02d:%02d]", GetName(i), i, Hour, Minute, Second);
    SendClientMessageToAll(RED, string);
    Kick(i);
    KickLog(string);
    }
and i want add it here
i renamed the file to
pawn Код:
NameLog(string);
Reply
#4

just change KickLog with NameLog
Reply
#5

oh sorry ^^ i mean the string with the kicktext should alive ... and the kicklog to ...
i want that the "NameLog(string)" only get the name of the kicked player and add it to an other file
Reply
#6

edit the format().
Reply
#7

i addet this:
pawn Код:
new namestring[56]
                  GetPlayerWeaponData(i, 7, weapon, ammo);
                if(weapon == 38 && ammo >= 1)
                {
                format(string, sizeof(string), "[Anti Weapon]: %s (id:%d) was kicked cause he is a fucking CHEATER (Minigun) [Time: %02d:%02d:%02d]", GetName(i), i, Hour, Minute, Second);
                SendClientMessageToAll(RED, string);
                format(string, sizeof(namestring), "%s", GetName(i));
                SendClientMessageToAll(RED, namestring);
                AccountInfo[i][Jail] = 1;
                Kick(i);
                KickLog(string);
                NameLog(namestring);
pawn Код:
forward NameLog(namestring[]);

public NameLog(namestring[])
{
    new entry[256];
    format(entry, sizeof(entry), "%s\n",namestring);
    new File:hFile;
    hFile = fopen("Badnames.cfg", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}
but if i get a minigun ingame the script kicks me but the server crash
Reply
#8

You need to make a new string with only name in it, because you are trying to write the string of Scm, while you only want name!
Reply
#9

i know but i dont tryed to make a string witk only his name?
Quote:
Originally Posted by Schock
i addet this:
pawn Код:
new namestring[56]
                  GetPlayerWeaponData(i, 7, weapon, ammo);
                if(weapon == 38 && ammo >= 1)
                {
                format(string, sizeof(string), "[Anti Weapon]: %s (id:%d) was kicked cause he is a fucking CHEATER (Minigun) [Time: %02d:%02d:%02d]", GetName(i), i, Hour, Minute, Second);
                SendClientMessageToAll(RED, string);
                format(string, sizeof(namestring), "%s", GetName(i)); // here?
                SendClientMessageToAll(RED, namestring); // here?
                AccountInfo[i][Jail] = 1;
                Kick(i);
                KickLog(string);
                NameLog(namestring);
pawn Код:
forward NameLog(namestring[]);

public NameLog(namestring[])
{
    new entry[256];
    format(entry, sizeof(entry), "%s\n",namestring);
    new File:hFile;
    hFile = fopen("Badnames.cfg", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}
but if i get a minigun ingame the script kicks me but the server crash
Reply
#10

what does KickLog do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)