AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How can i convert this code to engine ? (https://forums.alliedmods.net/showthread.php?t=183940)

Krycek 04-28-2012 16:25

How can i convert this code to engine ?
 
i dont know how can i convert get_tr2 to engine.

PHP Code:

stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
    static 
tr
    engfunc
(EngFunc_TraceHulloriginorigin0hullidtr)
    if (!
get_tr2(trTR_StartSolid) || !get_tr2(trTR_AllSolid)) //get_tr2(tr, TR_InOpen))
        
return true
    
    
return false



ConnorMcLeod 04-28-2012 16:51

Re: How can i convert this code to engine ?
 
instead of :

if( is_hull_vacant( origin, hullIndex, playerIndex ) )

Put in your code :

if( ! trace_hull(origin, hullIndex, playerIndex, 0) )


http://www.amxmodx.org/funcwiki.php?go=func&id=364

tracehull return is :

+1 if fStartSolid
+2 if fAllSolid
+4 if !fInOpen (that one was missing in your stock)

So if it returns 0, the place if free ;)


If you still don't want to check fInOpen, just do if( ~trace_hull(...) & 3 )

Krycek 04-28-2012 19:55

Re: How can i convert this code to engine ?
 
thanks Connor, you're the best!

CVarsMaster 04-28-2012 21:49

Re: How can i convert this code to engine ?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1698335)
instead of :

if( is_hull_vacant( origin, hullIndex, playerIndex ) )

Put in your code :

if( ! trace_hull(origin, hullIndex, playerIndex, 0) )


http://www.amxmodx.org/funcwiki.php?go=func&id=364

tracehull return is :

+1 if fStartSolid
+2 if fAllSolid
+4 if !fInOpen (that one was missing in your stock)

So if it returns 0, the place if free ;)


If you still don't want to check fInOpen, just do if( ~trace_hull(...) & 3 )

What it means these traceresult's values?

Arkshine 04-29-2012 04:22

Re: How can i convert this code to engine ?
 
http://forums.alliedmods.net/showpos...30&postcount=6


All times are GMT -4. The time now is 07:45.

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