SA-MP Forums Archive
Timer Bug or what is this??? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Timer Bug or what is this??? (/showthread.php?tid=423759)



Timer Bug or what is this??? - Kovacs_Richard - 19.03.2013

I have a problem with timers...I think the 1st timer after script load won't run...I found this in my GM 1st...
I made a script for test it...here is the script and the results...I commented the missed messages...

SCRIPT:
Код:
#include <a_samp>

forward Teszt(playerid);

public OnFilterScriptInit()
{
	print("Load Script");
	return 1;
}

public OnFilterScriptExit()
{
	print("Exit Script");
	return 1;
}

public OnPlayerConnect(playerid)
{
	SetTimerEx("Teszt",1000,0,"d",playerid);
	return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
	if(!strcmp(cmdtext,"/timer"))
	{
	    print("Teszt CMD");
		SetTimerEx("Teszt",1000,0,"d",playerid);
	    return 1;
	}
	return 0;
}

public Teszt(playerid)
{
	print("Teszt Runned");
	return 1;
}
RESULTS:
Код:
[2013.03.19. 11:08:20] Filterscripts
[2013.03.19. 11:08:20] ---------------
[2013.03.19. 11:08:20]   Loaded 0 filterscripts.

Console input: loadfs tbug
[2013.03.19. 11:08:27] Load Script
[2013.03.19. 11:08:27]   Filterscript 'tbug.amx' loaded.
[2013.03.19. 11:08:54] Incoming connection: 127.0.0.1:3244
[2013.03.19. 11:08:55] [join] krichie has joined the server (0:127.0.0.1)
// Teszt Runned ?!
[2013.03.19. 11:09:02] Teszt CMD
[2013.03.19. 11:09:03] Teszt Runned
[2013.03.19. 11:09:15] Teszt CMD
[2013.03.19. 11:09:16] Teszt Runned
Console input: reloadfs tbug
[2013.03.19. 11:09:20] Exit Script
[2013.03.19. 11:09:20]   Filterscript 'tbug.amx' unloaded.
[2013.03.19. 11:09:20] Load Script
[2013.03.19. 11:09:20]   Filterscript 'tbug.amx' loaded.
[2013.03.19. 11:09:24] Teszt CMD
// Teszt Runned ?!
[2013.03.19. 11:09:29] Teszt CMD
[2013.03.19. 11:09:30] Teszt Runned
Код:
Console input: loadfs tbug
[2013.03.19. 11:23:43] Load Script
[2013.03.19. 11:23:43]   Filterscript 'tbug.amx' loaded.
[2013.03.19. 11:24:07] Incoming connection: 127.0.0.1:3406
[2013.03.19. 11:24:07] [join] krichie has joined the server (0:127.0.0.1)
// Teszt Runned ?!
[2013.03.19. 11:24:13] [part] krichie has left the server (0:1)
[2013.03.19. 11:24:36] Incoming connection: 127.0.0.1:3409
[2013.03.19. 11:24:36] [join] krichie has joined the server (0:127.0.0.1)
[2013.03.19. 11:24:37] Teszt Runned
[2013.03.19. 11:24:39] [part] krichie has left the server (0:1)



Re: Timer Bug or what is this??? - Konstantinos - 19.03.2013

It worked fine for me.

pawn Код:
// Results:
[12:49:04] [join] Dwane has joined the server (0:127.0.0.1)
[12:49:06] Teszt Runned
[12:49:12] Teszt CMD
[12:49:13] Teszt Runned
[12:49:16] [part] Dwane has left the server (0:1)
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

forward Teszt(playerid);

public OnFilterScriptInit()
{
    print("Load Script");
    return 1;
}

public OnFilterScriptExit()
{
    print("Exit Script");
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetTimerEx("Teszt",1000,0,"d",playerid); // 1st message
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext, "/timer", true))
    {
        print("Teszt CMD"); //2nd message
        SetTimerEx("Teszt",1000,0,"d",playerid); // 3rd message
        return 1;
    }
    return 0;
}

public Teszt(playerid)
{
    print("Teszt Runned"); // 1st message and 3rd message
    return 1;
}



Re: Timer Bug or what is this??? - Kovacs_Richard - 19.03.2013

how do you load?
server.cfg or console?


Re: Timer Bug or what is this??? - Konstantinos - 19.03.2013

I added it to server.cfg


Re: Timer Bug or what is this??? - Kovacs_Richard - 19.03.2013

start server and load the script from console...


Re: Timer Bug or what is this??? - MP2 - 19.03.2013

OnPlayerDisconnect is only called for the first fioterscript that is loaded.


Re: Timer Bug or what is this??? - leong124 - 19.03.2013

Quote:
Originally Posted by Dwane
Посмотреть сообщение
It worked fine for me.

pawn Код:
// Results:
[12:49:04] [join] Dwane has joined the server (0:127.0.0.1)
[12:49:06] Teszt Runned
[12:49:12] Teszt CMD
[12:49:13] Teszt Runned
[12:49:16] [part] Dwane has left the server (0:1)
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

forward Teszt(playerid);

public OnFilterScriptInit()
{
    print("Load Script");
    return 1;
}

public OnFilterScriptExit()
{
    print("Exit Script");
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetTimerEx("Teszt",1000,0,"d",playerid); // 1st message
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext, "/timer", true))
    {
        print("Teszt CMD"); //2nd message
        SetTimerEx("Teszt",1000,0,"d",playerid); // 3rd message
        return 1;
    }
    return 0;
}

public Teszt(playerid)
{
    print("Teszt Runned"); // 1st message and 3rd message
    return 1;
}
After looking at your test results, I'm pretty sure OnPlayerConnect in his script is not even called. It is probably caused by incorrect callback hooking. Can you tell us what libraries have you included? (#include <library_name>)
If you only use a_samp, then the file may be messed up by improper optimization flag or plugin error. Show us if you have these.

Quote:
Originally Posted by MP2
Посмотреть сообщение
OnPlayerDisconnect is only called for the first fioterscript that is loaded.

There is no OnPlayerDisconnect in the script, and actually it does call for all the filterscripts and the gamemode, as I'm using the callback in multiple filterscripts and the gamemode.