AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] func_breakable how to know if it was used/broke? (https://forums.alliedmods.net/showthread.php?t=271167)

Jhob94 09-06-2015 18:14

[SOLVED] func_breakable how to know if it was used/broke?
 
So, in order to destroy an entity func_breakable, i did:
PHP Code:

new szClassname[14]
pev(iEntitypev_classnameszClassnamecharsmax(szClassname))
                
if(
equal(szClassname"func_breakable"))
    
dllfunc(DLLFunc_UseiEntity0

It works fine, but if i call the code again, it is used again. So, should i hook Ham_Use to check when it's used and block a second usage? Is there any better solution?

Rirre 09-07-2015 03:52

Re: func_breakable how to know if it was used/broke?
 
Check the health.
Code:
if( equal(szClassName, "func_breakable") && !(pev(pEntity, pev_spawnflags) & SF_BREAK_TRIGGER_ONLY) && pev(pEntity, pev_health) > 0 )

Jhob94 09-07-2015 04:11

Re: func_breakable how to know if it was used/broke?
 
Checking the health is fine enough or should i check the spawnflags too?

lazarev 09-07-2015 04:26

Re: func_breakable how to know if it was used/broke?
 
if pev->solid is SOLID_NOT then it's broken

Jhob94 09-07-2015 05:14

Re: func_breakable how to know if it was used/broke?
 
Quote:

Originally Posted by lazarev (Post 2340612)
if pev->solid is SOLID_NOT then it's broken

Yeah lol, wtf, how didn't i thought about this?

Thanks :crab:

Rirre 09-07-2015 06:31

Re: func_breakable how to know if it was used/broke?
 
Quote:

Originally Posted by Jhob94 (Post 2340609)
Checking the health is fine enough or should i check the spawnflags too?

If you want to blow up e.g. the boxes on de_dust2, then no.


All times are GMT -4. The time now is 22:17.

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