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

JailDoors


Post New Thread Reply   
 
Thread Tools Display Modes
Bibihotz
AlliedModders Donor
Join Date: Jul 2013
Old 11-15-2013 , 15:44   Re: JailDoors
Reply With Quote #11

Quote:
Originally Posted by shavit View Post
This is what I use for my Jailbreak server:
Code:
public Action:Command_Open(client, args)
{
    if(!IsValidClient(client))
    {
        return Plugin_Handled;
    }
    
    if(!IsPlayerAlive(client) && !CheckCommandAccess(client, "cell_open", ADMFLAG_GENERIC))
    {
        ReplyToCommand(client, "%s You can't open the cells when you're dead.", PREFIX);
        
        return Plugin_Handled;
    }
    
    if(GetClientTeam(client) != CS_TEAM_CT && !CheckCommandAccess(client, "cell_open", ADMFLAG_GENERIC))
    {
        ReplyToCommand(client, "%s You are not allowed to perform this command since you're not a prison guard or an admin.", PREFIX);
        
        return Plugin_Handled;
    }
    
    if(gB_CellsAreOpen)
    {
        ReplyToCommand(client, "%s Well, it looks like the cells are already open.", PREFIX);
        
        return Plugin_Handled;
    }
    
    new bool:Success;
    
    static gI_Entity;
    
    gI_Entity = -1;
    
    while((gI_Entity = Entity_FindByClassName(gI_Entity, "func_door")) != INVALID_ENT_REFERENCE)
    {
        new String:name[32];
        Entity_GetName(gI_Entity, name, 32);
        
        if(StrContains(name, "cell", false) != -1 || StrContains(name, "cage", false) != -1 || StrContains(name, "prison", false) != -1 || StrContains(name, "open", false) != -1 || StrContains(name, "taim", false) != -1 || StrContains(name, "jaildoor", false) != -1 || StrEqual(name, "c1", false))
        {
            AcceptEntityInput(gI_Entity, "Open");
            
            Success = true;
        }
    }
    
    gI_Entity = -1;
    
    while((gI_Entity = Entity_FindByClassName(gI_Entity, "func_button")) != INVALID_ENT_REFERENCE)
    {
        new String:name[32];
        Entity_GetName(gI_Entity, name, 32);
        
        if(StrEqual(gS_Currentmap, "jb_vipinthemix_v1_2", false))
        {
            if(Entity_GetHammerId(gI_Entity) == 40045)
            {
                AcceptEntityInput(gI_Entity, "Use");
                
                Success = true;
            }
        }
        
        else if(StrContains(name, "cell", false) != -1 || StrContains(name, "cage", false) != -1 || StrContains(name, "prison", false) != -1 || StrContains(name, "open", false) != -1 || StrContains(name, "taim", false) != -1 || StrContains(name, "jaildoor", false) != -1)
        {
            AcceptEntityInput(gI_Entity, "Use");
            
            Success = true;
        }
    }
    
    gB_CellsAreOpen = Success;
    
    if(Success)
    {
        ReplyToCommand(client, "%s You have opened the cells.", PREFIX);
        
        PrintToChatAll("%s \x074A4A4A%N\x01 has opened the cells!", PREFIX, client);
    }
    
    else
    {
        ReplyToCommand(client, "%s Welp, it looks like this map is not supported. Report to \x074A4A4Ashavit\x01.", PREFIX);
    }
    
    return Plugin_Handled;
}
It supports most of the maps.
did not compile ....
Bibihotz is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 11-15-2013 , 15:52   Re: JailDoors
Reply With Quote #12

Quote:
Originally Posted by Bibihotz View Post
did not compile ....
You need to include <smlib>.
__________________
retired
shavit is offline
Bibihotz
AlliedModders Donor
Join Date: Jul 2013
Old 11-15-2013 , 16:25   Re: JailDoors
Reply With Quote #13

Quote:
Originally Posted by shavit View Post
You need to include <smlib>.
can upload the smx please?
Bibihotz is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 11-16-2013 , 14:10   Re: JailDoors
Reply With Quote #14

Quote:
Originally Posted by Bibihotz View Post
can upload the smx please?
No, I'm not allowed to upload .smx only.

Code:
#include <sourcemod>
#include <sdktools>
#include <smlib>
#include <cstrike>

#define PREFIX "\x04[Jailbreak]\x01"

new bool:gB_CellsAreOpen;
new String:gS_Currentmap[32];

public OnMapStart()
{
     GetCurrentMap(gS_Currentmap, 32);   
}

public Action:Command_Open(client, args)
{
    if(!client)
    {
        return Plugin_Handled;
    }
    
    if(!IsPlayerAlive(client) && !CheckCommandAccess(client, "cell_open", ADMFLAG_GENERIC))
    {
        ReplyToCommand(client, "%s You can't open the cells when you're dead.", PREFIX);
        
        return Plugin_Handled;
    }
    
    if(GetClientTeam(client) != CS_TEAM_CT && !CheckCommandAccess(client, "cell_open", ADMFLAG_GENERIC))
    {
        ReplyToCommand(client, "%s You are not allowed to perform this command since you're not a prison guard or an admin.", PREFIX);
        
        return Plugin_Handled;
    }
    
    if(gB_CellsAreOpen)
    {
        ReplyToCommand(client, "%s Well, it looks like the cells are already open.", PREFIX);
        
        return Plugin_Handled;
    }
    
    new bool:Success;
    
    static gI_Entity;
    
    gI_Entity = -1;
    
    while((gI_Entity = Entity_FindByClassName(gI_Entity, "func_door")) != INVALID_ENT_REFERENCE)
    {
        new String:name[32];
        Entity_GetName(gI_Entity, name, 32);
        
        if(StrContains(name, "cell", false) != -1 || StrContains(name, "cage", false) != -1 || StrContains(name, "prison", false) != -1 || StrContains(name, "open", false) != -1 || StrContains(name, "taim", false) != -1 || StrContains(name, "jaildoor", false) != -1 || StrEqual(name, "c1", false))
        {
            AcceptEntityInput(gI_Entity, "Open");
            
            Success = true;
        }
    }
    
    gI_Entity = -1;
    
    while((gI_Entity = Entity_FindByClassName(gI_Entity, "func_button")) != INVALID_ENT_REFERENCE)
    {
        new String:name[32];
        Entity_GetName(gI_Entity, name, 32);
        
        if(StrEqual(gS_Currentmap, "jb_vipinthemix_v1_2", false))
        {
            if(Entity_GetHammerId(gI_Entity) == 40045)
            {
                AcceptEntityInput(gI_Entity, "Use");
                
                Success = true;
            }
        }
        
        else if(StrContains(name, "cell", false) != -1 || StrContains(name, "cage", false) != -1 || StrContains(name, "prison", false) != -1 || StrContains(name, "open", false) != -1 || StrContains(name, "taim", false) != -1 || StrContains(name, "jaildoor", false) != -1)
        {
            AcceptEntityInput(gI_Entity, "Use");
            
            Success = true;
        }
    }
    
    gB_CellsAreOpen = Success;
    
    if(Success)
    {
        ReplyToCommand(client, "%s You have opened the cells.", PREFIX);
        
        PrintToChatAll("%s \x074A4A4A%N\x01 has opened the cells!", PREFIX, client);
    }
    
    else
    {
        ReplyToCommand(client, "%s Welp, it looks like this map is not supported. Report to \x074A4A4Athe server owner\x01.", PREFIX);
    }
    
    return Plugin_Handled;
}
Compile it there: http://www.sourcemodplugins.org/smwebide/
__________________
retired
shavit 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 12:44.


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