#1

Hi I have this code:
Код:
forward UpdateCzasJazdy(playerid);
public UpdateCzasJazdy(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
sekundy[playerid]++;
if(sekundy[playerid] == 60)
{
minuty[playerid]++;
sekundy[playerid] = 00;
}
new str[256];
format(str, sizeof(str), "Czas Jazdy:~w~   %02d:%02d", minuty, sekundy);
TextDrawSetString(CzasJazdy[playerid], str);
}
return 1;
}
And Timer:
Код:
TimerPojazd4[playerid] = SetTimerEx("UpdateCzasJazdy", 1111, true,"i",playerid);
And the timer is killed when a player goes out of the vehicle. I have a problem with that. When a player with id 0 goes out of the vehicle a timer is killed for everyone but should only him.

Код:
KillTimer(TimerPojazd4[playerid]);
Please Help
Reply
#2

1. Indent properly.
2. Use [ pawn ] tags not [ code ].
3. Debug your code - add prints (or client messages) in your timer to see who it's being called for.
4. If the timer is killed when the player gets out of the vehicle, why is this in your timer:

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
Reply
#3

So how to reapir it ? I deleted form code:
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
But nothing has changed.
Reply
#4

FOLLOW ALL THE STEPS THEN. NOT JUST A SINGLE ONE.
Reply
#5

I follow all the steps but i don't know whats the problem :/
Reply
#6

Have you put client messages/prints in like I said?
Reply
#7

But where i must put it ?
Reply
#8

pawn Код:
TimerPojazd4[playerid] = SetTimerEx("UpdateCzasJazdy", 1111, true,"i",playerid);
Where is this piece of code placed? I have a feeling that 'playerid' is not properly defined.
Reply
#9

I put it into:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
//Here Timer
    }else{
//Here KillTimer
}
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)