killtimer because it does not work?
#1

Код:
forward firstspawn(playerid);
forward CD2(playerid);
forward CD3(playerid);
forward CD4(playerid);
forward CD5(playerid);
forward CD6(playerid);
forward CD7(playerid);
forward CD8(playerid);
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME];
    new string[126];
    KillTimer(DragTimer[playerid]);
    KillTimer(firstspawn(playerid));
    KillTimer(CD2(playerid));
    KillTimer(CD3(playerid));
    KillTimer(CD4(playerid));
    KillTimer(CD5(playerid));
    KillTimer(CD6(playerid));
    KillTimer(CD7(playerid));
    KillTimer(CD8(playerid));
Not by any error ... just do not work!
Thank's
Reply
#2

To stop the timer, you need to remember his id. Example:

Array for timers: new CDtimer[6];

Creating: CDTimer[0] = SetTimer("CD2"....);

Killing: KillTimer(CDTimer[0]);

Sorry for my bad English
Reply
#3

WHY SIX = Array for timers: new CDtimer[6];

Thank you!!
Reply
#4

You don't specifically need an array of six for one timer. It might be useful to store six timers in an array of six, although this is not required. You can use six different variables as well.
Reply
#5

Quote:
Originally Posted by Basssiiie
Посмотреть сообщение
You don't specifically need an array of six for one timer. It might be useful to store six timers in an array of six, although this is not required. You can use six different variables as well.
That's all good and well (sort of) until he does this with 100 variables because nobody told him to use arrays.
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
That's all good and well (sort of) until he does this with 100 variables because nobody told him to use arrays.
Yeah, but I'm not sure if 100 timers is a great idea. Anyway, I just wanted to tell him that both options will technically work.
Reply
#7

certain that it is a great thing ... finished the timer 1 starts the 2 .. it is a tutorial rp...
Sorry for my bad english! Thank's
Reply
#8

Quote:
Originally Posted by Basssiiie
Посмотреть сообщение
I just wanted to tell him that both options will technically work.
So will this:

pawn Код:
new player0var;
new player1var;
new player2var;
etc.
But that doesn't mean you should do that instead of an array. Arrays are meant to be used for a set of variables. Variables are meant to be used for single things.
Reply
#9

@MP2: No of course that's not a great idea. I was more talking about variables like this:
Код:
new firstspawntimer;
new anticheattimer;
new healthregentimer;
new clockupdatetimer;
There are reasons where you want to use this instead of an array. If you would make an array called "new timerlist[4]", it's less clear what timer each slot holds. Of course you can use enum's as well to solve this problem, but why the extra hassle? Using four different variables is not that big of a deal and can be easier for someone reading the script.

If you really want to put things in arrays, you could also just use "new variable[200]" and never initialize any variable after that. Only use that array to save variables. That's possible too, but it isn't very easy to use.

I'm sorry if my previous posts were a bit unclear.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)