P1xeL

Opened Cells

Nov 10th, 2012
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.09 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <hamsandwich>
  3. #include <engine>
  4. #include <colorchat>
  5. #include <cstrike>
  6. #include <fakemeta>
  7.  
  8. #define fm_find_ent_by_class(%1,%2)     engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
  9.  
  10. new const PREFIX [] = "[Jailbreak]"
  11.  
  12. new bool:CellOpen;
  13.  
  14. //Never used:
  15. //new Classname[] = "thinkent"
  16.  
  17. new cvar_allow_open;
  18.  
  19. // Seconds Left
  20. #if defined _secondsleft_included
  21.     #endinput
  22. #endif
  23. #define _secondsleft_included
  24.  
  25. #pragma library "secondsleft"  
  26.  
  27. native get_remaining_seconds();
  28.  
  29. public plugin_init() {
  30.     register_plugin("Opened Cells","2.0","Firippu | Edited: vonamoR");
  31.    
  32.     register_logevent("Event_NewRound",2,"1=Round_Start");
  33.     register_clcmd("say /open", "cmd_open");
  34.    
  35.     cvar_allow_open = register_cvar("amx_allow_open","1");
  36.    
  37.     RegisterHam(Ham_Use,"func_button","Forward_Use");
  38. }
  39.  
  40. public Event_NewRound()
  41.     CellOpen = false;
  42.  
  43. public Forward_Use(ent,id) {
  44.     if(!CellOpen)
  45.     {
  46.         static targetname[12];
  47.         static target[12];
  48.        
  49.         entity_get_string(ent,EV_SZ_targetname,targetname,11);
  50.         entity_get_string(ent,EV_SZ_target,target,11);
  51.        
  52.         if(equal(targetname,"cellcontrol") || equal(targetname,"release") || equal(target,"cell_door") || equal(target,"jail_door"))
  53.         {
  54.             CellOpen = true;
  55.            
  56.             static name[32],TimeLeft,Minutes,Seconds;
  57.             get_user_name(id,name,31);
  58.            
  59.             TimeLeft = get_remaining_seconds();
  60.            
  61.             Minutes = (TimeLeft / 60);
  62.             Seconds = (TimeLeft % 60);
  63.            
  64.             ColorChat(0, NORMAL, "[eG`]^4%s^1 %s ^4opened the cells at %d:%d", PREFIX, name, Minutes, Seconds);
  65.         }
  66.     }
  67.     return 1;
  68. }
  69.  
  70. public cmd_open(id) {
  71.     if(!get_pcvar_num(cvar_allow_open))
  72.         return 1;
  73.    
  74.     if(get_user_flags(id) & ADMIN_KICK || is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
  75.     {
  76.         new TimeLeft, Name[33], Ent = -1;
  77.         while((Ent = fm_find_ent_by_class(Ent, "func_door")))
  78.             dllfunc(DLLFunc_Use, Ent, 0);
  79.        
  80.         get_user_name(id, Name, charsmax(Name));
  81.         TimeLeft = get_remaining_seconds();
  82.         ColorChat(0, NORMAL, "[eG`]^4%s^1 %s ^4opened the cells at %d:%d", PREFIX, Name, TimeLeft / 60, TimeLeft % 60);
  83.     }
  84.     return 1;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment