Raised This Month: $ Target: $400
 0% 

Delete trigger


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
RapZzw3rR
Member
Join Date: May 2012
Location: Romania
Old 05-02-2012 , 10:46   Re: Delete trigger
Reply With Quote #5

Here I created two small zones for tests..
PHP Code:
#include <amxmodx>
#include <engine>
#include <ColorChat>

#define PLUGIN "HNS Where"
#define VERSION "1.0"
#define MAX_ZONES 2
#define MAX_SOUNDS 1
#pragma semicolon 1

new bool:RoofMap false;

new 
bool:Sound[33];
new 
bool:Message[33];

new 
cvar_tag;

static const 
Where_Ent[] = "trigger_where";

new const 
FloatMins[MAX_ZONES][3] =
{
    {-
445.2386.71025.0},
    {-
477.7, -1112.5641.5}
};

new const 
FloatMaxs[MAX_ZONES][3] =
{
    {-
323.2444.71027.0},
    {-
455.7, -1090.5643.5}
};

new const 
Types[MAX_ZONES] =
{
     
12
};

new const 
Messages[MAX_ZONES+1][] =
{
    
"",
    
"Boxes, pop dog",
    
"Box, umbrellas"
};

public 
plugin_precache()
{
    new 
mapName[33];
    
get_mapname(mapName32);
    
    if(!
equali(mapName"awp_rooftops"12) || equali(mapName"awp_rooftops_remake"19))
    {
        
RoofMap false;
    }
    else
    
RoofMap true;
}

public 
plugin_init()
{
    if(!
RoofMap)
    {
        new 
pluginName[33];
        
format(pluginName32"%s dezactivated"PLUGIN);
        
register_plugin(pluginNameVERSION"Rap");
        
pause("ade");
    }
    else if(
RoofMap)
    {
        
register_plugin(PLUGINVERSION"Rap");
        
register_clcmd"say""hook_say" );
        
register_touch(Where_Ent"player""FwdTriggerTouch");
        
register_concmd("amx_where""cmdWhere"ADMIN_ALL"<name>");
        
cvar_tag register_cvar("where_tag""[Where]");
    }
}

public 
CreateWhereZones()
{
    for (new 
0MAX_ZONESi++)
    {
        
CreateTrigger(Types[i], Mins[i], Maxs[i]);
    }
}

CreateTrigger(const EntType, const Float:flMins[3], const Float:flMaxs[3])
{
    new 
iEntity create_entity("info_target");
    
    if(!
is_valid_ent(iEntity))
    {
        return 
0;
    }
    
    
entity_set_string(iEntityEV_SZ_classnameWhere_Ent);
    
entity_set_int(iEntityEV_INT_iuser1EntType);
    
entity_set_int(iEntityEV_INT_movetypeMOVETYPE_NONE);
    
entity_set_int(iEntityEV_INT_solidSOLID_TRIGGER);
    
entity_set_size(iEntityflMinsflMaxs);
    
    return 
iEntity;
}

public 
DeleteWhereZones()
{
    
//HERE I REALLY NEED HELP!
    //HERE I REALLY NEED HELP!
    //HERE I REALLY NEED HELP!
    //HERE I REALLY NEED HELP!
}

public 
WhereMenu(id)
{
    new 
WhereMenuMsg[64];
    
formatex(WhereMenuMsg63"\rHide'N'Seek Where");
    new 
MenuWhere menu_create(WhereMenuMsg"WhereMenuHandler"0);
    
    new 
wheremsg[64], wheresound[64];
    
formatex(wheremsg63"\yMessages: %s"Message[id] ? "\w Activated" "\d Dezactivated");
    
formatex(wheresound63"\ySounds: %s"Sound[id] ? "\w Activated" "\d Dezactivated");
    
    
menu_additem(MenuWherewheremsg"1"0);
    
menu_additem(MenuWherewheresound"2"0);
    
    
    
menu_setprop(MenuWhereMPROP_EXITNAME"\yExit");
    
menu_display(idMenuWhere0);
    
    return 
1;
}

public 
WhereMenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        return 
1;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key) {
        case 
1: {
            
WhereMsg(id);
            
WhereMenu(id);
        }
        case 
2: {
            
WhereSound(id);
            
WhereMenu(id);
        }
    }
    
    return 
1;
}

public 
WhereMsg(id)
{
    new 
tag[32];
    
get_pcvar_string(cvar_tagtagsizeof(tag) -1);
    
    if(
Message[id])
    {
        
Message[id] = false;
        
ColorChat(idRED"^x04%s^x01 The messages are now^x03 dezactivated^x01!"tag);
        return 
PLUGIN_HANDLED;
    }
    else if(!
Message[id])
    {
        
Message[id] = true;
        
ColorChat(idBLUE"^x04%s^x01 The messages are now^x03 activated^x01!"tag);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}

public 
WhereSound(id)
{
    new 
tag[32];
    
get_pcvar_string(cvar_tagtagsizeof(tag) -1);
    
    if(
Sound[id])
    {
        
Sound[id] = false;
        
ColorChat(idRED"^x04%s^x01 The sounds are now^x03 dezactivated^x01!"tag);
        return 
PLUGIN_HANDLED;
    }
    else if(!
Sound[id])
    {
        
Sound[id] = true;
        
ColorChat(idBLUE"^x04%s^x01 The sounds are now^x03 activated^x01!"tag);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}

public 
FwdTriggerTouch(const iEntity, const id)
{
    if(
is_user_ok(id))
    {
        static 
Type;
        
Type entity_get_int(iEntityEV_INT_iuser1);
        
        new 
Players[32], name[32], tag[32];
        new 
PlayersNumplayer;
        
        
get_pcvar_string(cvar_tagtagsizeof(tag) -1);
        
get_user_name(idnamesizeof(name) - 1);
    
        
get_players(PlayersPlayersNum"ch");        
        for(new 
i=0i<PlayersNumi++)
        {
            
player Players[i];
            if(
Message[player])
            {
                
ColorChat(playerRED"^x04%s^x03 %s^x01 is now[^x04 %s^x01]!",tagnameMessages[Type]);
            }
            if(
Sound[player])
            {
                
client_cmd(player,"spk vox/doop");
            }
        }
        
DeleteWhereZones();
    }
    return 
0;
}

public 
cmdWhere(id)
{
    
CreateWhereZones();
    return 
1;
}

public 
hook_say(id)
{
    static 
args[192], command[192];
    
read_args(args,charsmax(args));
    
    if(!
args[0]) {
        return 
PLUGIN_CONTINUE;
    }    
    
remove_quotes(args[0]);
    if(
equal(args"/where"strlen("/where")))
    {
        
replace(args,charsmax(args), "/""" );
        
formatexcommandcharsmax(command) , "amx_%s"args );
        
client_cmd(idcommand);
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

stock is_user_ok(id)
{
    if(
is_user_alive(id) && is_user_connected(id) && !is_user_bot(id))
        return 
1;
        
    return 
0;


Last edited by RapZzw3rR; 05-02-2012 at 10:48.
RapZzw3rR is offline
 



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 07:52.


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