y_timers not being called again?
#1

Okay, I am using y_timers, I have never had this problem before, but for some reason, my timer is only being called once?

task PrimaryTick[1000]()
{
print("Tick is being called");
}

It only prints it once, and I have a kick function under there, which doesn't work either?

I really don't know how to resolve this

(And I have it included as this: '#include <YSI\y_timers>' at the bottom of my includes list
Reply
#2

Personally, I would recommend using the SetTimerEx function and then forward your timer. This is how you would do what you are wanting to do with SetTimerEx:

Under the defines
pawn Код:
forward PrimaryTick(playerid);
Whatever is executing your command (starting the timer):
pawn Код:
SetTimerEx("PrimaryTick", 1000, false, "i", playerid);//false is if it's repeating, if you wish for it to repeat change it to true
Create a public such as:
pawn Код:
Public PrimaryTick(playerid)
{
          print("Tick is being called");
          return 1;
}
Reply
#3

I know, I always use y_timers though and have never come across this problem, so I would love to find a way to resolve it.

Thank you for the help though.
Reply
#4

Are you using this timer on a filter-script or a game-mode?

I ask because if you're loading this as a filter-script, which isn't started DIRECTLY (as in put in the filterscripts line in server.cfg) when the server starts- YSI may not be working properly, hence why you're having this issue.

I am currently using the task function, as well as the ptask function, alongside many different timers- no issues at all.
Reply
#5

I'm actually having the same problem. I updated to the latest YSI a few days back, and weird stuff started happening in my test GM. Now it turns out timers weren't getting called. As far as I remember, before the update everything worked fine. I hope this gets fixed.

EDIT: I have crashdetect running all the time. Nothing unusual is printed in the console.

EDIT 2: I just restored the old YSI from the recycle bin, tested and timers work fine.
Reply
#6

pawn Код:
task PrimaryTick[1000]()
{
    print("Tick is being called");
    foreach(new i: Player)
    {
        if(GetPVarInt(i, "Kick") != 0)
        {
            if(gettime() > GetPVarInt(i, "Kick"))
            {
                Kick(i);
            }
        }
        if(IsPlayerInAnyVehicle(i))
        {
            new Float: vHealth;
            GetVehicleHealth(GetPlayerVehicleID(i), vHealth);
           
            if(vHealth < 351)
            {
                SetVehicleHealth(GetPlayerVehicleID(i), 351);
            }
        }
        if(GetPlayerCash(i) != GetPlayerMoney(i))
        {
            ResetMoney(i);
            UpdateMoney(i, GetPlayerCash(i));
        }
    }
}
Timer. ^^

Thank you for all the responses, I am going to try the crashdetect plugin now.

EDIT: Nothing print's on the console with the crashdetect plugin.
Reply
#7

I restored an old version of YSI, and it worked. But now when I compile my GM, I get these warnings:

pawn Код:
C:\Users\Matty\Desktop\San Fierro Roleplay\pawno\include\YSI\internal\..\y_scriptinit.inc(132) : warning 209: function "SSCANF_OnFilterScriptInit" should return a value
C:\Users\Matty\Desktop\San Fierro Roleplay\pawno\include\YSI\internal\..\y_scriptinit.inc(168) : warning 209: function "SSCANF_OnGameModeInit" should return a value
Reply
#8

Anyone?
Reply
#9

Do you have the YSI libary from one before the last release?
Reply
#10

Great, thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)