gmkeyhook.h: class MDB_SSGM_Taunt_Key : public MDB_SSGM_KeyHook { Vector3 oldpos, newpos; bool can_use_taunts; void Created(GameObject *obj); void KeyHookFunc(); void Timer_Expired(GameObject *obj,int number); gmkeyhook.cpp: void MDB_SSGM_Taunt_Key::Created(GameObject *obj) { if (is_keyhook_set != 1337) { hookid = AddHook(Get_Parameter("Key"),obj); is_keyhook_set = 1337; can_use_taunts = true; } } void MDB_SSGM_Taunt_Key::KeyHookFunc() { if (Get_Vehicle(Owner()) == 0) { Commands->Start_Timer(Owner(),this,0.1,442); } } void MDB_SSGM_Taunt_Key::Timer_Expired(GameObject *obj,int number) { float oldpos2; if (number == 442) { oldpos = Commands->Get_Position(Owner()); Commands->Start_Timer(Owner(),this,0.1,443); oldpos2 = oldpos.Z; } if ((number == 443) && (can_use_taunts == true)){ can_use_taunts = false; Console_Input("msg Timer number 443 expired"); newpos = Commands->Get_Position(Owner()); //New position 0.5 seconds later char zdifference_check[500]; sprintf(zdifference_check, "msg zdifference = %f, oldpos.Z = %f, newpos.Z = %f ", (oldpos.Z - newpos.Z), oldpos.Z, newpos.Z); Console_Input(zdifference_check); if ((oldpos.Z - newpos.Z) < (float)1.000000 ) { char checkthisshit[500]; sprintf(checkthisshit,"msg %f", (oldpos.Z - newpos.Z) ); Console_Input(checkthisshit); Commands->Set_Animation(Owner(),Get_Parameter("Anim"),false,0,0.0f,-1.0f,false); //play animation if Z-height didn't change in those 0.5 secs Commands->Start_Timer(Owner(),this,5,444); //Timer to limit use of taunts to every 5 secs } } if (number == 444) { can_use_taunts = true; } }