Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sdkhooks>
- #include <sdktools>
- float CoolDown[MAXPLAYERS+1];
- public OnPluginStart()
- {
- HookEvent("door_open",Event_OpenDoor);
- HookEvent("door_close",Event_CloseDoor);
- for(int i = 1; i <= MaxClients; ++i)
- {
- CoolDown[i] = GetEngineTime();
- }
- }
- public Action:Event_OpenDoor(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new i = GetClientOfUserId(GetEventInt(event, "userid"));
- if((GetEngineTime() - CoolDown[i]) >= 10.0)
- {
- CoolDown[i] = GetEngineTime();
- return Plugin_Continue;
- }
- return Plugin_Handled;
- }
- public Action:Event_CloseDoor(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- if((GetEngineTime() - CoolDown[client]) >= 10.0)
- {
- CoolDown[client] = GetEngineTime();
- return Plugin_Continue;
- }
- return Plugin_Handled;
- }
Advertisement
Add Comment
Please, Sign In to add comment