AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Breakable things (https://forums.alliedmods.net/showthread.php?t=304934)

ArminC 02-01-2018 06:01

Breakable things
 
So this can show you wich entity is breakable like wood ramp, or some box.. but this is showing the Bomb Site Green boxes (https://www.johnsto.co.uk/i/design/m...alpha_b_01.jpg) that are breakable but in fact they are only by the C4/RPG. Can you make an ignore for these type of entitiy?

HTML Code:

#include <amxmodx>
#include <engine>
#include <reapi>

// Defines
#define AIMTASK 500

// Cvars
new cvar_message_type

public plugin_init()
{
        register_plugin("Breakable Hint", "1.1", "Raheem")
       
        // Cvars
        cvar_message_type = register_cvar("break_hint_type", "2")
       
        // Tasks
        set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
}

public Check_AimTask()
{
        if (get_pcvar_num(cvar_message_type) == 0)
        {
                remove_task(AIMTASK, 0)
                return
        }
       
        for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
        {
                if (!is_user_alive(id))
                        continue
               
                new iEntIndex, iBody
                get_user_aiming(id, iEntIndex, iBody)
               
                if(is_valid_ent(iEntIndex) && !is_user_connected(iEntIndex))
                {
                        new szClassName[32]
                       
                        get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
                       
                        if(equal(szClassName, "func_breakable"))
                        {
                                if (get_pcvar_num(cvar_message_type) == 1)
                                {
                                        set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
                                        show_hudmessage(id, "You can break this entity!")
                                }
                                else if (get_pcvar_num(cvar_message_type) == 2)
                                {
                                        client_print(id, print_center, "You can break this entity!")
                                }
                        }
                }
        }
}


ArminC 02-04-2018 07:33

Re: Breakable things
 
Bump!?

klippy 02-04-2018 08:06

Re: Breakable things
 
Instead of
PHP Code:

if(equal(szClassName"func_breakable")) 

put
PHP Code:

if(equal(szClassName"func_breakable") && !(entity_get_int(iEntIndexEV_INT_flags) & SF_BREAK_TRIGGER_ONLY)) 

Also what's the reason for using get_entvar()? I don't get this madness lately with people unnecessarily using ReAPI.

ArminC 02-04-2018 08:10

Re: Breakable things
 
Thanks, it's not my plugin.. was edited at my request at a Forum that use often ReHLDS&ReAPI.. Is there any efficency problem or is that you don't like so much ReAPI :D?

klippy 02-04-2018 09:36

Re: Breakable things
 
The problem is that there are 2 existing ways in AMXX that do the exact same thing, just as fast, and someone chooses to use something that not everybody has on their server.

ArminC 02-04-2018 11:51

Re: Breakable things
 
@KliPPy I tested it and still show at BombSite Green Box that they are breakable :\

ArminC 02-07-2018 07:18

Re: Breakable things
 
Bump?!

ArminC 02-26-2018 10:20

Re: Breakable things
 
up!

baneado 05-11-2022 14:16

Re: Breakable things
 
3 years later, but fixing the wrong solution.

It is spawnflags, not flags
PHP Code:

if(equal(szClassName"func_breakable") && !(entity_get_int(iEntIndexEV_INT_spawnflags) & SF_BREAK_TRIGGER_ONLY)) 



All times are GMT -4. The time now is 14:11.

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