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", 1000, false, "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", 1000, false, "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", 1000, false, "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')