Raised This Month: $ Target: $400
 0% 

[HELP] Door Options


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mrki_Drakula
Senior Member
Join Date: Jun 2011
Location: Serbia
Old 12-27-2012 , 00:29   [HELP] Door Options
Reply With Quote #1

Alright, I've searched and searched alot and tried coding myself, but I just couldn't find a right solution for my problem.

I need a code that opens closed jailbreak cells, close open ones, and same for all the doors.

This is my idea:

MENU:
- Open/Close Cells
- Open/Close Doors

How should I accomplish this?
__________________
-----------------------------------------------
Best regards,
David Snajder (aka Crysis)
Mrki_Drakula is offline
Send a message via MSN to Mrki_Drakula Send a message via Skype™ to Mrki_Drakula
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 12-27-2012 , 03:18   Re: [HELP] Door Options
Reply With Quote #2

All doors have only 1 class, not possible to open only cells, Possible to open all doors
__________________
simanovich is offline
Mrki_Drakula
Senior Member
Join Date: Jun 2011
Location: Serbia
Old 12-27-2012 , 03:38   Re: [HELP] Door Options
Reply With Quote #3

Wrong, you are able to check for the door class, and open only the one that fills your needs. Already done that.

Anyone?
__________________
-----------------------------------------------
Best regards,
David Snajder (aka Crysis)
Mrki_Drakula is offline
Send a message via MSN to Mrki_Drakula Send a message via Skype™ to Mrki_Drakula
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 12-27-2012 , 03:43   Re: [HELP] Door Options
Reply With Quote #4

Quote:
Originally Posted by Mrki_Drakula View Post
Wrong, you are able to check for the door class, and open only the one that fills your needs. Already done that.

Anyone?
You Wrong!!!

It's possible to open all doors, but not a specific door(s), in this case, cells.
All doors have only 1 class
__________________
simanovich is offline
Mrki_Drakula
Senior Member
Join Date: Jun 2011
Location: Serbia
Old 12-27-2012 , 03:52   Re: [HELP] Door Options
Reply With Quote #5

Quote:
You Wrong!!!

It's possible to open all doors, but not a specific door(s), in this case, cells.
All doors have only 1 class
Aint you able to filter doors that are near TT spawn place, which means they are cells, then open them?
__________________
-----------------------------------------------
Best regards,
David Snajder (aka Crysis)
Mrki_Drakula is offline
Send a message via MSN to Mrki_Drakula Send a message via Skype™ to Mrki_Drakula
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 12-27-2012 , 04:36   Re: [HELP] Door Options
Reply With Quote #6

Here you go

only admins and ct can write /open

Code:
#include <amxmodx>
#include <fakemeta> 
#include <cstrike> 

#define PLUGIN "Open Cells"
#define VERSION "0.0.1"
#define AUTHOR "Freestyle"

#define PREFIX "Jailbreak"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /open", "open_cells")
}

public open_cells(id)
{
    if(cs_get_user_team(id) == CS_TEAM_CT)
    {
        new szGuardName[32]
        get_user_name(id, szGuardName, charsmax(szGuardName))
        
        set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, -1.0, 0, 6.0, 12.0)
        show_hudmessage(0, "[%s]^n= Guard %s open the cells =", PREFIX, szGuardName)
        
        while(engfunc(EngFunc_FindEntityByString, -1, "classname", "func_door"))
        { 
            dllfunc(DLLFunc_Use, -1, 0)
        }
    }
    else if( get_user_flags(id) & ADMIN_BAN )
    {
        new szGuardName[32]
        get_user_name(id, szGuardName, charsmax(szGuardName))
        
        set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, -1.0, 0, 6.0, 12.0)
        show_hudmessage(0, "[%s]^n= Admin %s open the cells =", PREFIX, szGuardName)
        
        while(engfunc(EngFunc_FindEntityByString, -1, "classname", "func_door"))
        { 
            dllfunc(DLLFunc_Use, -1, 0)
        }
    }
} 
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 12-27-2012 , 04:56   Re: [HELP] Door Options
Reply With Quote #7

Quote:
Originally Posted by ironskillz1 View Post
Here you go

only admins and ct can write /open

Code:
#include <amxmodx>
#include <fakemeta> 
#include <cstrike> 

#define PLUGIN "Open Cells"
#define VERSION "0.0.1"
#define AUTHOR "Freestyle"

#define PREFIX "Jailbreak"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /open", "open_cells")
}

public open_cells(id)
{
    if(cs_get_user_team(id) == CS_TEAM_CT)
    {
        new szGuardName[32]
        get_user_name(id, szGuardName, charsmax(szGuardName))
        
        set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, -1.0, 0, 6.0, 12.0)
        show_hudmessage(0, "[%s]^n= Guard %s open the cells =", PREFIX, szGuardName)
        
        while(engfunc(EngFunc_FindEntityByString, -1, "classname", "func_door"))
        { 
            dllfunc(DLLFunc_Use, -1, 0)
        }
    }
    else if( get_user_flags(id) & ADMIN_BAN )
    {
        new szGuardName[32]
        get_user_name(id, szGuardName, charsmax(szGuardName))
        
        set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, -1.0, 0, 6.0, 12.0)
        show_hudmessage(0, "[%s]^n= Admin %s open the cells =", PREFIX, szGuardName)
        
        while(engfunc(EngFunc_FindEntityByString, -1, "classname", "func_door"))
        { 
            dllfunc(DLLFunc_Use, -1, 0)
        }
    }
} 
Better code:
PHP Code:
#include <amxmodx>
#include <fakemeta> 

#define PREFIX "Jailbreak"

enum _:Teams{
    
FM_TEAM_UNASSIGNED,
    
FM_TEAM_T,
    
FM_TEAM_CT,
    
FM_TEAM_SPECTATOR
};

public 
plugin_init(){
    
register_plugin("Open Cells","0.0.1","Freestyle");
    
register_clcmd("say /open","open_cells");
}

public 
open_cells(id){
    if(
is_user_can(id))
    {
        new 
szGuardName[32];
        
get_user_name(id,szGuardName,charsmax(szGuardName));
        
        
set_hudmessage(random_num(0,255),random_num(0,255),random_num(0,255),-1.0,-1.0,0,6.0,12.0);
        
show_hudmessage(0,"[%s]^n= %s %s open the cells =",PREFIX,is_user_admin(id) ? "Admin":"Guard",szGuardName);
        
        while(
engfunc(EngFunc_FindEntityByString, -1"classname""func_door"))
            
dllfunc(DLLFunc_Use, -10);
    }


stock bool:is_user_can(index){
    if(
is_user_admin(index))
        return 
true;

    if(!
is_user_alive(index) || fm_get_user_team(index) != FM_TEAM_CT)
    {
        
client_print(index,print_chat,"[AMXX] You must be guard and alive!");
        return 
false;
    }

    return 
true;
}

stock bool:is_user_admin(index)
    return 
get_user_flags(index) & ADMIN_ADMIN true:false;

stock fm_get_user_team(index)
    return 
get_pdata_int(index,114); 
__________________
simanovich is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 12-27-2012 , 11:33   Re: [HELP] Door Options
Reply With Quote #8

simanovich I don't agree that your code is better, you added three stocks, so when player using say /open
PHP Code:
call open_cells(id)
COMPARE+BRANCH
new szGuardName[32]
call get_user_name
call set_hudmessage
call show_hudmessage
call 
while
        { 
          
call dllfunc(DLLFunc_Use, -10)
        }
COMPARE+BRANCH
new szGuardName[32]
call get_user_name
call set_hudmessage
call  show_hudmessage
call 
while
        { 
          
call dllfunc(DLLFunc_Use, -10)
        }
end
2 compares in each 4 call, 1 loop, one variable, each teration call.

in your case:

PHP Code:
call open_cells(id)
call +compare+branch (is_user_can(id)
    
call+compare+branch is_user_admin
        call
+compare+branch get_user_flags
    call
+compare+branch is_user_alivefm_get_user_team
        call get_pdata_int
new szGuardName
call get_user_name
call set_hudmessage
call show_hudmessage
call 
while
    
call dllfunc 
more call, more compares..more efficient
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
fl0werD
Senior Member
Join Date: May 2011
Old 12-27-2012 , 11:44   Re: [HELP] Door Options
Reply With Quote #9

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Open Cells""0.0.1""Freestyle")
    
register_clcmd("say /open""ClCmdOpenCells")
}

public 
ClCmdOpenCells(pPlayer)
{
    new 
iState;

    if(
get_pdata_int(pPlayer114) == 2)
        
iState 0;
    else if(
get_user_flags(pPlayer) & ADMIN_BAN)
        
iState 1;
    else
        return;

    new 
szName[32];
    
get_user_name(pPlayerszNamecharsmax(szName))

    
set_hudmessage(random_num(1255), random_num(1255), random_num(1255), -1.0, -1.006.012.0)
    
show_hudmessage(0"[Jailbreak]^n= %s %s open the cells ="iState == "Guard" "Admin"szName)

    while(
engfunc(EngFunc_FindEntityByString, -1"classname""func_door")) dllfunc(DLLFunc_Use, -10)

And so?
fl0werD is offline
Send a message via ICQ to fl0werD
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 12-27-2012 , 11:58   Re: [HELP] Door Options
Reply With Quote #10

PHP Code:
public ClCmdOpenCells(pPlayer)
{
    if(
get_pdata_int(pPlayer114) == 2)
    {
        new 
szName[32];
        
get_user_name(pPlayerszNamecharsmax(szName))
        
set_hudmessage(random_num(1255), random_num(1255), random_num(1255), -1.0, -1.006.012.0)
        
show_hudmessage(0"[Jailbreak]^n= guard %s open the cells ="szName)
        while(
engfunc(EngFunc_FindEntityByString, -1"classname""func_door")) dllfunc(DLLFunc_Use, -10)
    }
    else if(
get_user_flags(pPlayer) & ADMIN_BAN)
    {
        new 
szName[32];
        
get_user_name(pPlayerszNamecharsmax(szName))
        
set_hudmessage(random_num(1255), random_num(1255), random_num(1255), -1.0, -1.006.012.0)
        
show_hudmessage(0"[Jailbreak]^n= admin %s open the cells ="szName)
        while(
engfunc(EngFunc_FindEntityByString, -1"classname""func_door")) dllfunc(DLLFunc_Use, -10)
    }

Only two compares, only one new variable.
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT

Last edited by AngeIII; 12-27-2012 at 11:59.
AngeIII is offline
Send a message via Skype™ to AngeIII
Reply


Thread Tools
Display Modes

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 13:44.


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