Problem with date timer
#1

Hello ladies and guys,

I wrote yesterday a timer for my server. This timer should write every 60 minutes the date of the day to every player only once. But in fact the server send this message 30+ times. I don't know what a failure I made. I hope anybody can help me with this:

pawn Код:
forward DatumTimer();
Under GameModeInit

pawn Код:
SetTimer("DatumTimer",36000000,true);
The whole code:

pawn Код:
public DatumTimer()
{
    new year, month, day;
    getdate (year, month, day);
    new coordsstring[256];
    format(coordsstring, sizeof(coordsstring),"SERVER: Datum: %d.%d.%d",day,month,year);
    SendClientMessageToAll(0xFF0000FF,coordsstring);
    return 1;
}
Regards, ThomasTailor93
Reply
#2

I don't see anything that would cause the message to be sent more than once every 60 minutes to each player. Are you sure you're not using a timer to call "DatumTimer" function somewhere else?

Also additionally your string length is madness! 256 cells for that message? The message has a max length of around 24! That's a lot of wasted memory being allocated

Edit: You've also got an extra 0 in the timer length, which means it's called every 10 hours instead of 1 hour!
Reply
#3

Hi JaTochNietDan,
thanks for your help. I defined "DatumTimer" only once and I'm using it only in this function. Hm...strange

Edit: Language failure ^^
Edit 2: Well, I could be fixed after setting up string. And I put the timer to an other position. Anyway, thanks for help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)