SA-MP Forums Archive
read file problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: read file problem (/showthread.php?tid=374553)



read file problem - Fires - 03.09.2012

Hi all, i created a clan system for my server.

This is my script:

pawn Код:
// This is a comment
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new stringa[500], nome[MAX_PLAYER_NAME];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Tagga");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    new File:sfile;
    sfile = fopen("TagUff.txt", io_read);
    GetPlayerName(playerid, nome, sizeof(nome));
    format(stringa, sizeof(stringa), "[IPS]%s", nome);
    new banstr[512];
    while(fread(sfile,banstr))
    {
        if (strfind(banstr, stringa, true) != -1)
        {
            SendClientMessage(playerid, -1, "Benvenuto!");
        }
        else
        {
            SendClientMessage(playerid, -1, "Tag non ufficializzata");
          Kick(playerid);
        }
    }
    fclose(sfile);
    return 1;
}

CMD:tagga(playerid, params[])
{
    new ricevente;
    if(sscanf(params, "u", ricevente))
    {
        SendClientMessage(playerid, -1, "Usa: /tagga [id]");
        return 1;
    }
    new File:Open;
    Open=fopen("TagUff.txt", io_append);
    GetPlayerName(ricevente, nome, sizeof(nome));
    format(stringa, sizeof(stringa), "[IPS]%s", nome);
    fwrite(Open, stringa);
    fclose(Open);
    return 1;
}
But when i enter server without tag, it kick me, and if i write my nickname if TagUff.txt file, it kick me.

Sorry for my bad english з_з


Re: read file problem - Fires - 03.09.2012

Bump!


Re: read file problem - Fires - 04.09.2012

Bump!


Re: read file problem - Fires - 07.09.2012

HELP.