FlacoBey

Untitled

Jan 7th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <sdkhooks>
  2. #include <sdktools>
  3.  
  4. float CoolDown[MAXPLAYERS+1];
  5.  
  6. public OnPluginStart()
  7. {
  8.     HookEvent("door_open",Event_OpenDoor);  
  9.     HookEvent("door_close",Event_CloseDoor);
  10.     for(int i = 1; i <= MaxClients; ++i)
  11.     {
  12.         CoolDown[i] = GetEngineTime();
  13.     }
  14. }
  15.  
  16. public Action:Event_OpenDoor(Handle:event, const String:name[], bool:dontBroadcast)
  17. {
  18.     new i = GetClientOfUserId(GetEventInt(event, "userid"));
  19.    
  20.     if((GetEngineTime() - CoolDown[i]) >= 10.0)
  21.     {
  22.         CoolDown[i] = GetEngineTime();
  23.         return Plugin_Continue;
  24.     }
  25.     return Plugin_Handled;
  26. }
  27.  
  28. public Action:Event_CloseDoor(Handle:event, const String:name[], bool:dontBroadcast)
  29. {
  30.     new client = GetClientOfUserId(GetEventInt(event, "userid"));
  31.     if((GetEngineTime() - CoolDown[client]) >= 10.0)
  32.     {
  33.         CoolDown[client] = GetEngineTime();
  34.         return Plugin_Continue;
  35.     }
  36.     return Plugin_Handled;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment