AlliedModders

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

Vechta 07-14-2010 14:36

Need code
 
Hey,
someone can tell me the code if im aiming at players body it follow (example: a chain lightning)? I need only code without lightning.. If someone can help me it will be very usefull :D

grimvh2 07-14-2010 14:51

Re: Need code
 
PHP Code:

new ententbody
get_user_aiming
(idententbody)

if(
ent)
{
    new 
szClassname[32]
    
pev(entpev_classnameszClassnamecharsmax(szClassname)
    
    if(
equal(szClassname"player")
    {
        
// code
    
}
}

// put it in prethink 


Vechta 07-14-2010 14:58

Re: Need code
 
Quote:

Originally Posted by grimvh2 (Post 1239103)
PHP Code:

new ententbody
get_user_aiming
(idententbody)

if(
ent)
{
    new 
szClassname[32]
    
pev(entpev_classnameszClassnamecharsmax(szClassname)
    
    if(
equal(szClassname"player")
    {
        
// code
    
}
}

// put it in prethink 


ehm, thank you you can include also distance code?

Vechta 07-14-2010 15:38

Re: Need code
 
solved

Alka 07-14-2010 15:40

Re: Need code
 
at "if" statement add another bracket ")" at end.

Vechta 07-14-2010 15:43

Re: Need code
 
Quote:

Originally Posted by Alka (Post 1239162)
at "if" statement add another bracket ")" at end.

solved :D but can you give me code for distance please :D?

grimvh2 07-14-2010 16:16

Re: Need code
 
Quote:

Originally Posted by Alka (Post 1239162)
at "if" statement add another bracket ")" at end.

Yep, and another one at pev heres good :

PHP Code:

new ententbody 
get_user_aiming
(idententbodydistance// just change distance with an int

if(ent

    new 
szClassname[32
    
pev(entpev_classnameszClassnamecharsmax(szClassname)) 
     
    if(
equal(szClassname"player"))
    { 
        
// code 
    



// put it in prethink 


PattyBiena 07-14-2010 16:16

Re: Need code
 
Quote:

Originally Posted by Vechta (Post 1239165)
solved :D but can you give me code for distance please :D?

PHP Code:

public any_public(id)
{
    new 
ententbody
    get_user_aiming
(idententbody)
    
    if(
ent)
    {
        new 
szClassname[32], originF[3], originF2[3]
        
        
pev(entpev_classnameszClassnamecharsmax(szClassname))
        
get_user_origin(entoriginF)
        
get_user_origin(idoriginF2)
        
        if(
equal(szClassname"player") && get_distance(originForiginF2) > 500.0)
        {
            
// code
        
}
    } 



grimvh2 07-14-2010 16:18

Re: Need code
 
Quote:

Originally Posted by PattyBiena (Post 1239215)
PHP Code:

public any_public(id)
{
    new 
ententbody
    get_user_aiming
(idententbody)
    
    if(
ent)
    {
        new 
szClassname[32], originF[3], originF2[3]
        
        
pev(entpev_classnameszClassnamecharsmax(szClassname))
        
get_user_origin(entoriginF)
        
get_user_origin(idoriginF2)
        
        if(
equal(szClassname"player") && get_distance(originForiginF2) > 500.0)
        {
            
// code
        
}
    } 



why in god's name would u do that?

Code:

Description
  get_user_aiming - Traces where a player is aiming for a maximum  distance defaulted to 9999.
  get_user_aiming ( index, &id,  &body, [ distance ] )



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

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