Function being called over and over again
#1

Hello!
I've made a similiar topic a day ago but the problem has changed.

For some reason this function (located in OnPlayerConnect) gets called A LOT of times for no reason, when it clearly should execute only once.
Код:
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        AktywnyDialog[playerid] = 2;
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD,"Logowanie","{FFA500}* * * LOGOWANIE\n\n{FFFFFF}Witamy ponownie, wpisz swoje {FF0000}hasło{FFFFFF}, aby się zalogować.\n","Zaloguj","Wyjdź");
    }
Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    printf("* test");
    return 1;
}
Logs:
Код:
[22:34:26] [join] Amads has joined the server (0:127.0.0.1)
[22:34:26] * test
[22:34:26] * test
[22:34:26] * test
[22:34:26] * test
[22:34:26] * test
[22:34:26] * test
[22:34:26] * test
And it goes on and on...
Reply
#2

I'm no expert in INI-parsers, but my guess would be that function is called everytime there is a parameter-entry in the file below the [data] block.

How many times does it run, and how many lines are usually stored in your playerfile?

Wouldn't such a function determine which parameter is read (name), along with it's value (value), so you can take appropriate action?

Try to add this in that function:
PHP код:
printf("Name = %s"name);
printf("Value = %s"value); 
And see what it prints.
Reply
#3

Ignore this comment, mistake.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)