AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sky (https://forums.alliedmods.net/showthread.php?t=64132)

Doc-Holiday 12-08-2007 23:16

Sky
 
ok using engine how can i make it so if im aiming at the sky i cant use the hook?

Code:

if (iContents == CONTENTS_SKY)
 {
  return PLUGIN_HANDLED
 }

i saw this in the new hook mod but i just want to add it to mine. how can i do that.. thanks for helping

M249-M4A1 12-08-2007 23:37

Re: Sky
 
That looks right. You need to fill in what iContents is first.

PHP Code:

// If cvar sv_hooksky is 0 and hook is in the sky remove it!
    
new iContents engfunc(EngFunc_PointContentsentOrigin)
    if (!
get_pcvar_num(pHookSky) && iContents == CONTENTS_SKY)
    {
        if(
get_pcvar_num(pSound))
            
emit_sound(HookEntCHAN_STATIC"weapons/xbow_hit2.wav"1.0ATTN_NORM0PITCH_NORM)
        
remove_hook(id)
    } 

From the new hook

Doc-Holiday 12-08-2007 23:47

Re: Sky
 
i know what the new hook says but

i want it so that if i aim at the sky and hook it wont connect.... if you know what i mean...

Also can some one right me a function that will allow a hook to open a door?

M249-M4A1 12-08-2007 23:51

Re: Sky
 
PHP Code:

new iContents engfunc(EngFunc_PointContentsentOrigin)

if (
iContents == CONTENTS_SKY)
    
// do nothing (or remove a hook if it already shot)
    
return PLUGIN_HANDLED 


Doc-Holiday 12-09-2007 01:38

Re: Sky
 
That dosent explain to me how this works it says entorigin dosent exist and engfun is fake meta im not using fakemeta i dont know how....

M249-M4A1 12-09-2007 03:56

Re: Sky
 
You asked for the code first, rather than an explanation. Look up what var entOrigin is in the Hook plugin, and you will know.

Quote:

im not using fakemeta i dont know how....
Add the following line of code into your includes section of your script, and it will use FakeMeta:

PHP Code:

include <fakemeta

For the code, plain and simply:
1) iContents holds the contents of the target
2) if (iContents == CONTENTS_SKY) checks if iContents (your target) is the sky
3) return PLUGIN_HANDLED stops the rest of the code in that procedure from running, so this acts like a "do nothing"

Doc-Holiday 12-09-2007 14:33

Re: Sky
 
..... it still tells me that entorigin dosent exist

and im not that dumb i put fakemeta in using that code but i have no idea wat entorigin is.

M249-M4A1 12-09-2007 14:51

Re: Sky
 
Like I said earlier, entOrigin is a variable. It is user created. Go look up what entOrigin is inside the new hook plugin, and you will see what it is, and how it's used.

[ --<-@ ] Black Rose 12-09-2007 14:59

Re: Sky
 
Code:

get_user_origin ( index, origin[3], [ mode = 0 ] )

index is a player index from 1 to 32.

The origin is stored in the vector (3 member array) passed as the second parameter.
origin[0] = X coordinate
origin[1] = Y coordinate
origin[2] = Z coordinate

If mode is passed, the origin changes:
0 - current position (Default)
1 - Position from eyes (weapon aiming)
2 - End position from player position
3 - End position from eyes (hit point for weapon)
4 - Position from last bullet hit (only CS)

Code:
new iOrigin[3]; get_user_origin (id, iOrigin, 3); new iContents = engfunc(EngFunc_PointContents, iOrigin); if ( iContents == CONTENTS_SKY )     // do nothing (or remove a hook if it already shot)     return PLUGIN_HANDLED;


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

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