SA-MP Forums Archive
Callback / Timers 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: Callback / Timers problem (/showthread.php?tid=583351)



Callback / Timers problem - Nin9r - 27.07.2015

Hi there !

I have a problem with callbacks and some timers.Actually, some timers are working but not all of them.

For example, the global timers are working ( SetTimer("SetPlayerUnjail", 1000, 1);,SetTimer("CheckCar", 1000, 1);etc.) , but when i'm calling a function like "SetTimerEx("LoadTrailers", 1000, false, "d", tmpcar);" , "SetTimerEx("StartFarm", 5000, true, "d", playerid);" for a player it stuck. That callback is not started and it doesn't work properly. Even if i`m using a command to start it not working... :
Код:
CMD:farm(playerid, params[])
{
	        	   StartFarm(playerid);
	return 1;
}
What can I do ?
Which is the problem?

PS: sorry for my english.


AW: Callback / Timers problem - Mencent - 27.07.2015

Hello!

Can you send us the code where are you starting this timer and the callback?


Re: Callback / Timers problem - Moudix - 27.07.2015

When you use for exemple :
PHP код:
SetTimerEx("test"1000false"i"playerid); 
You need then to forward the timer ,then a callback.
PHP код:
forward test(playerid);
public 
test(playerid)

SendClientMessage(playerid, -1"test");
return 
1;




Re: Callback / Timers problem - Nin9r - 27.07.2015

Quote:
Originally Posted by Moudix
Посмотреть сообщение
When you use for exemple :
PHP код:
SetTimerEx("test"1000false"i"playerid); 
You need then to forward the timer ,then a callback.
PHP код:
forward test(playerid);
public 
test(playerid)

SendClientMessage(playerid, -1"test");
return 
1;

I knew how to use a timer. I am not a newbie.

The callbacks doesn't work properly, not even timers.

For example, /stats command which calls PUBLIC SHOWSTATS doesn't work sometimes for any players.


AW: Callback / Timers problem - Mencent - 27.07.2015

Can you send us your timer with this callback which doesn't work?


Re: AW: Callback / Timers problem - Nin9r - 27.07.2015

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Can you send us your timer with this callback which doesn't work?
Код:
new tmpcar = GetPlayerVehicleID(playerid);
SetTimerEx("LoadTrailers", 1000, false, "d", tmpcar);
and

Код:
forward LoadTrailers(vehicleid);
public LoadTrailers(vehicleid)
{
    if(IsPlayerInVehicle(playerid,vehicleid))
    {
            new vehicleid = GetPlayerVehicleID(i);
	            new tmpcar = GetPlayerVehicleID(i);
	    AttachTrailerToVehicle(PlayerData[playerid][pTrailer],tmpcar);
	}
	return 1;
}
It is an example.. but i have more function which is not working.


AW: Callback / Timers problem - Mencent - 27.07.2015

PHP код:
SetTimerEx("LoadTrailers"1000false"dd"tmpcar,playerid);
forward LoadTrailers(vehicleid,playerid);
public 
LoadTrailers(vehicleid,playerid)
{
    if(
IsPlayerInVehicle(playerid,vehicleid))
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
tmpcar GetPlayerVehicleID(playerid);
        
AttachTrailerToVehicle(PlayerData[playerid][pTrailer],tmpcar);
    }
    return 
1;

You have to look how you use playerid, and so on.


Re: Callback / Timers problem - Nin9r - 02.08.2015

Sometimes, /stats command doesn't work. It is the same, I am using /stats to call Stats(targetid,playerid); and for some players it doesn't work properly.


Re: Callback / Timers problem - Mencent - 02.08.2015

Can you give us your code?


Re: Callback / Timers problem - Nin9r - 07.08.2015

I have this error in mysql_log. Is possible to be the reason for stuck timers and callbacks?

[ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')