Raised This Month: $12 Target: $400
 3% 

Who Opened Jail Cells


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
vonamoR
Junior Member
Join Date: Jul 2011
Location: Pizza Hut, Walmart
Old 08-09-2011 , 00:29   Who Opened Jail Cells
Reply With Quote #1

Who Opened Jail Cells

What does this plugin do?
- It just tells everyone who opened the cells...
EX: [AMXX] Someone has opened the cells!

What maps does this work on?
- some1s_jailbreak, jb_snow, jail_204jailbreak_v1, jail_bobbylicious...

Things to do...
- Add Open cells automatically at 8:00
- Makes this plugin work for most of the Jailbreak maps.

Credits:
* Firippu - Most of the code
* vonamoR - Made it work on other maps.

CVARS:
- amx_allow_open (DEFAULT: 1. If set to 0 the command /open will not work anymore.)

Notes:
- I put the "[AMXX] Someone has opened the cells!" in green so you are gonna need ColorChat.inc
- How to change Prefix?
* Find new const PREFIX [] = "[Jailbreak]" and change [Jailbreak] to what ever you want...

This is my first plugin, so I will try to do my best to answer all of your questions.
- Thanks...

VERSION 2.0: You can now open the cells by typing /open. If you do not like this command, you can disable it.
Attached Files
File Type: sma Get Plugin or Get Source (open_cells.sma - 1314 views - 2.3 KB)
File Type: inc colorchat.inc (2.5 KB, 326 views)

Last edited by vonamoR; 08-13-2011 at 23:41.
vonamoR is offline
How2Troll
Junior Member
Join Date: May 2011
Old 08-10-2011 , 12:52   Re: Who Opened Jail Cells
Reply With Quote #2

Could you add a /open command for it to open? Thanks.
How2Troll is offline
vonamoR
Junior Member
Join Date: Jul 2011
Location: Pizza Hut, Walmart
Old 08-10-2011 , 19:26   Re: Who Opened Jail Cells
Reply With Quote #3

Never tested it, but I added /open command. You can disable the open command with this command "amx_cvar amx_allow_open"
__________________

Last edited by vonamoR; 08-13-2011 at 23:41.
vonamoR is offline
How2Troll
Junior Member
Join Date: May 2011
Old 08-10-2011 , 19:52   Re: Who Opened Jail Cells
Reply With Quote #4

I tested it & it works great. Could you also add when the cell was open in the format Minutes:Seconds? For example if it was opened at 8:51 , it would display Player has opened the cells at 8:51. Thanks!

Last edited by How2Troll; 08-10-2011 at 20:20. Reason: Suggestion.
How2Troll is offline
vonamoR
Junior Member
Join Date: Jul 2011
Location: Pizza Hut, Walmart
Old 08-10-2011 , 20:36   Re: Who Opened Jail Cells
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <colorchat>
#include <cstrike>

new const PREFIX [] = "[Jailbreak]"

new bool:CellOpen
new Classname[] = "thinkent"

new cvar_allow_open

// Seconds Left
#if defined _secondsleft_included
    #endinput
#endif
#define _secondsleft_included

#pragma library "secondsleft" 

native get_remaining_seconds()
//

public plugin_init()
{
    
register_plugin("Opened Cells","2.0","Firippu | Edited: vonamoR")
    
    
register_logevent("Event_NewRound",2,"1=Round_Start")
    
register_clcmd("say /open""cmd_open")
    
    
cvar_allow_open register_cvar("amx_allow_open","1")
    
    
RegisterHam(Ham_Use,"func_button","Forward_Use")
}

public 
Event_NewRound()
{
    
CellOpen false
}

public 
Forward_Use(ent,id)
{
    if(!
CellOpen)
        {
        static 
targetname[12]
            static 
target[12]
        
            
entity_get_string(ent,EV_SZ_targetname,targetname,11)
            
entity_get_string(ent,EV_SZ_target,target,11)
        
            if(
equal(targetname,"cellcontrol") || equal(targetname,"release") || equal(target,"cell_door") || equal(target,"jail_door"))
            {
                
CellOpen true
            
                
static name[32],TimeLeft,Minutes,Seconds
                get_user_name
(id,name,31)
            
                
TimeLeft get_remaining_seconds()
            
                
Minutes = (TimeLeft 60)
                
Seconds = (TimeLeft 60)
                
                
ColorChat(0NORMAL"^4%s^1 %s ^4opened the cells at %d:%d"PREFIXnameMinutesSeconds)  
        }
    }
    return 
PLUGIN_HANDLED
}
  
public 
cmd_open(id)
{
    if(!
get_pcvar_num(cvar_allow_open))
        return 
PLUGIN_HANDLED
    
    
if(!is_user_alive(id))
    {
        
ColorChat(idNORMAL"^4%s^1 You must be alive to use this command!"PREFIX)
        return 
PLUGIN_HANDLED
    
}
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
ColorChat(idNORMAL"^4%s^1 You must be a CT to use this command!"PREFIX)
        return 
PLUGIN_HANDLED
    
}
    
    
open_cells(id)
    return 
PLUGIN_HANDLED
}

public 
open_cells(id)
{
    new 
Map[32]
    
get_mapname(Map31)
    
    new 
Ent create_entity("info_target")
        
entity_set_string(Ent,EV_SZ_classname,Classname)
        
entity_set_float(Ent,EV_FL_nextthink,get_gametime() + 1.0)
    
    
register_think(Classname,"Forward_Think")
    
    if(
equal(Map,"some1s_jailbreak"))
    {
        
ColorChat(0NORMAL"^4%s^1 The cells have been opened!"PREFIX);
        
        new 
ent
        ent 
find_ent_by_tname(ent,"cellcontrol")
        
force_use(Ent,ent)
          
        return 
PLUGIN_HANDLED    
    
}
    
    else if(
equal(Map,"jb_snow"))
    {
        
ColorChat(0NORMAL"^4%s^1 The cells have been opened!"PREFIX);
         
        new 
ent
        ent 
find_ent_by_tname(ent,"jail_door")
        
force_use(Ent,ent)
          
        return 
PLUGIN_HANDLED
    
}
    
    else if(
equal(Map,"jail_bobbylicious"))
    {
        
ColorChat(0NORMAL"^4%s^1 The cells have been opened!"PREFIX);
         
        new 
ent
        ent 
find_ent_by_tname(ent,"release")
        
force_use(Ent,ent)
          
        return 
PLUGIN_HANDLED
    
}
    
    else if(
equal(Map,"jail_204jailbreak_v1"))
    {
        
ColorChat(0NORMAL"^4%s^1 The cells have been opened!"PREFIX);
         
        new 
ent
        ent 
find_ent_by_tname(ent,"cell_door")
        
force_use(Ent,ent)
          
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_HANDLED

__________________
vonamoR is offline
How2Troll
Junior Member
Join Date: May 2011
Old 08-10-2011 , 20:48   Re: Who Opened Jail Cells
Reply With Quote #6

L 08/10/2011 - 17:421: [AMXX] Plugin "Open_Cells.amxx" failed to load: Module/Library "secondsleft" required for plugin. Check modules.ini.
How2Troll is offline
Old 08-10-2011, 21:54
vonamoR
This message has been deleted by vonamoR.
How2Troll
Junior Member
Join Date: May 2011
Old 08-10-2011 , 22:34   Re: Who Opened Jail Cells
Reply With Quote #7

Unable to compile.
[IMG]http://img508.**************/img508/5082/unabletocompile.png[/IMG]

Uploaded with **************

Last edited by How2Troll; 08-10-2011 at 22:35. Reason: AAA
How2Troll is offline
vonamoR
Junior Member
Join Date: Jul 2011
Location: Pizza Hut, Walmart
Old 08-10-2011 , 22:45   Re: Who Opened Jail Cells
Reply With Quote #8

Erase this.
PHP Code:
#if defined _secondsleft_included
    #endinput
#endif
#define _secondsleft_included

#pragma library "secondsleft" 

native get_remaining_seconds() 
__________________
vonamoR is offline
How2Troll
Junior Member
Join Date: May 2011
Old 08-10-2011 , 23:11   Re: Who Opened Jail Cells
Reply With Quote #9

Could you also put Player (namehere) has opened the cells at Minutes:Seconds, instead of it displaying the Server name has opened the cells at 8:51 etc.

Last edited by How2Troll; 08-10-2011 at 23:13. Reason: .
How2Troll is offline
vonamoR
Junior Member
Join Date: Jul 2011
Location: Pizza Hut, Walmart
Old 08-11-2011 , 18:27   Re: Who Opened Jail Cells
Reply With Quote #10

Uploaded.
__________________

Last edited by vonamoR; 08-13-2011 at 23:42.
vonamoR is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode