29.10.2009, 15:15
Ok this is really frustating me since I can't find what I did wrong. I have an /open command and this is what's in it:
When I /open it opens and it closes after 7 seconds. < OK
When I /open it opens and I /open again it closes < OK
When I /open it opens and I /open again it closes, then I /u again and it opens again. But then about 4 seconds later it already closes!! < NOT OK
So the KillTimer doesnt work for some reason!?
(the /open command is for opening and closing the gate. the if(ZLSPDGATE == 1 or 0) means if it's closed (0) or opened (1) )
pawn Код:
new ZLSPDGATE=0;
// if(the /open command)
{
if(PlayerToPoint(12.0, playerid,1545.380615, -1626.557739, 12.544723))
{
if(gTeam[playerid] == TEAM_COP)
{
new LSPDt44;
if(ZLSPDGATE == 0)
{
LSPDt44 = SetTimer("LSPDGATETimer", 7000, 0);
MoveObject (LSPDGATE1,1545.419556, -1644.020020, 12.544723,10);
MoveObject (LSPDGATE2,1545.419556, -1644.020020, 12.544723,5);
ZLSPDGATE = 1;
}
else if(ZLSPDGATE == 1)
{
KillTimer(LSPDt44);
MoveObject (LSPDGATE1,1545.380615, -1626.557739, 12.544723,10);
MoveObject (LSPDGATE2,1545.402588, -1635.251831, 12.544723,5);
ZLSPDGATE = 0;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You're not a cop");
}
return 1;
}
}
// the LSPDGATETimer:
fpublic LSPDGATETimer()
{
ZLSPDGATE = 0;
MoveObject (LSPDGATE1,1545.380615, -1626.557739, 12.544723,10);
MoveObject (LSPDGATE2,1545.402588, -1635.251831, 12.544723,5);
return 1;
}
When I /open it opens and I /open again it closes < OK
When I /open it opens and I /open again it closes, then I /u again and it opens again. But then about 4 seconds later it already closes!! < NOT OK
So the KillTimer doesnt work for some reason!?
(the /open command is for opening and closing the gate. the if(ZLSPDGATE == 1 or 0) means if it's closed (0) or opened (1) )