Timer problem
#1

Hi,
I have a timer that I'm using at my login system. The repeat function is set to false, but it is still repeating and I can't even kill the timer, because it just does not work.

Код:
LoginSpawnT[playerid] = SetTimerEx("AutoSpawn", 1000*60, false, "i", playerid);
That is the code how I create the timer. (I don't think there should be any problem with the code )
Код:
KillTimer(LoginSpawnT[playerid]);
And that is how I'm trying to kill it.

Does anyone have any idea what is wrong with it?
Reply
#2

Where do you set it?
Reply
#3

Quote:
Originally Posted by kadar
Посмотреть сообщение
Hi,
I have a timer that I'm using at my login system. The repeat function is set to false, but it is still repeating and I can't even kill the timer, because it just does not work.

Код:
LoginSpawnT[playerid] = SetTimerEx("AutoSpawn", 1000*60, false, "i", playerid);
That is the code how I create the timer. (I don't think there should be any problem with the code )
Код:
KillTimer(LoginSpawnT[playerid]);
And that is how I'm trying to kill it.

Does anyone have any idea what is wrong with it?
Idk how to solve the problem but if you ask me, use SetTimer:

Код:
SetTimer("AutoSpawn", 1000*60, false);
Idk if it's better but it's definitely easier to use, I use it in my script.
Reply
#4

Quote:
Originally Posted by Mirsen2
Посмотреть сообщение
Idk how to solve the problem but if you ask me, use SetTimer:

Код:
SetTimer("AutoSpawn", 1000*60, false);
Idk if it's better but it's definitely easier to use, I use it in my script.
SetTimer is for GLOBAL timers, it should be used for server utilities, such as saving stats each X minutes and so on.

You need SetTimerEx to make a player timer.
Reply
#5

Quote:
Originally Posted by Unkovic
Посмотреть сообщение
Where do you set it?
I have text draws with details after login. So I set it in a public function (using mysql_tquery) after logging in. It's supposed to spawn me automatically and kill the timer after the 60 seconds passed, but the timer keeps going on.
Reply
#6

There is no need to set a timer to spawn automatically a player. Just use SpawnPlayer(playerid); after the player logged in.
Reply
#7

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
There is no need to set a timer to spawn automatically a player. Just use SpawnPlayer(playerid); after the player logged in.
I am aware of that. But if i just used SpawnPlayer(playerid); I would lose one of my cool features at the login :/ That's why I need the timer to delay the spawning time.
Reply
#8

Ok please summarize what you're trying to do so we can help you better.

From the input login password to the completed login. Summarize this.
Reply
#9

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
Ok please summarize what you're trying to do so we can help you better.

From the input login password to the completed login. Summarize this.
So when I connect to the server login dialog shows up. I enter my password and then a few textdraws appear and show me details about my character. (eg. Name, level, helath etc.) At that point I want the gamemode to show me these datails for one minute, and then spawn me.

Edit: I solved the problem somehow I've just deleted a timer, so now it's one less and everything works fine, but I still do not know what was wrong. I suppose there was some kind of bug.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)