22.03.2012, 15:59
how to stop a TimerEx. i have a code as below
i want to stop these TimerEx when pressing the enter button
pawn Код:
forward dance1(playerid);
forward dance2(playerid);
forward dance3(playerid);
forward dance4(playerid);
forward dance5(playerid);
forward dance6(playerid);
forward dance7(playerid);
forward dance8(playerid);
forward dance9(playerid);
forward dance10(playerid);
CMD:dance(playerid, params[])
{
#pragma unused params
ApplyAnimation( playerid, "DANCING" , "DANCE_LOOP" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
SetTimerEx("dance1", 2000, false, "d", playerid);
SetTimerEx("dance2", 4000, false, "d", playerid);
SetTimerEx("dance3", 6000, false, "d", playerid);
SetTimerEx("dance4", 8000, false, "d", playerid);
SetTimerEx("dance5", 10000, false, "d", playerid);
SetTimerEx("dance6", 12000, false, "d", playerid);
SetTimerEx("dance7", 14000, false, "d", playerid);
SetTimerEx("dance8", 16000, false, "d", playerid);
SetTimerEx("dance9", 18000, false, "d", playerid);
SetTimerEx("dance10", 20000, false, "d", playerid);
return 1;
}
public dance1(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DAN_DOWN_A" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance2(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DAN_LEFT_A" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance3(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DAN_LOOP_A" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance4(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DAN_RIGHT_A" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance5(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DAN_UP_A" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance6(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DNCE_M_A" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance7(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DNCE_M_B" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance8(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DNCE_M_C" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance9(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DNCE_M_D" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
public dance10(playerid)
{
ApplyAnimation( playerid, "DANCING" , "DNCE_M_E" , 2.0 , 0 , 1 , 1 , 0 , 2000 , 1);
}
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys == KEY_SECONDARY_ATTACK)
{
//what should be here???
return 1;
}