Callback / Timers problem
#1

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.
Reply
#2

Hello!

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

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;

Reply
#4

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.
Reply
#5

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

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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

Can you give us your code?
Reply
#10

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')
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)