Raised This Month: $ Target: $400
 0% 

Thunder lenght


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-12-2017 , 15:17   Thunder lenght
Reply With Quote #1

I'm trying to create a thunder between attacker and his enemy. Thats the code i'm using:

PHP Code:

new const gBeamSprite[] = "sprites/lgtning.spr"
new gBoltSprite 
PHP Code:
public plugin_precache()
{
    
gBoltSprite precache_model(gBeamSprite)

PHP Code:
new iTargetiBody
get_user_aiming
(idiTargetiBody170)

if(
pev_valid(iTarget))
{
    new 
iOrigin[3], iTargetOrigin[3]
    
get_user_origin(idiOrigin0)
    
get_user_origin(iTargetiTargetOrigin0)

    
CreateThunder(iOriginiTargetOrigin)

PHP Code:
CreateThunder(iStart[3], iEnd[3])
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BEAMPOINTS)
    
write_coord(iStart[0]) 
    
write_coord(iStart[1])
    
write_coord(iStart[2])
    
write_coord(iEnd[0]) 
    
write_coord(iEnd[1]) 
    
write_coord(iEnd[2]) 
    
write_short(gBoltSprite
    
write_byte(1)
    
write_byte(1)
    
write_byte(4)
    
write_byte(30)
    
write_byte(30)
    
write_byte(120
    
write_byte(40)
    
write_byte(255)
    
write_byte(255)
    
write_byte(25)
    
message_end()

The problem is: When I miss the shot the thunder doesn't appear, cause the pev_valid. I want to know if is possible to show the thunder even if I miss with X lenght.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-12-2017 at 15:26.
EFFx is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-12-2017 , 15:22   Re: Thunder lenght
Reply With Quote #2

Quote:
I'm trying to create a thunder between attacker and the victim.
What exactly are "attacker" and "target" here? It looks like you are polling to see if a player is aiming at an entity. Please elaborate more on what you are trying to achieve.
klippy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-12-2017 , 15:24   Re: Thunder lenght
Reply With Quote #3

If he's aiming at an enemy, not an entity. Read all the post, I've explained more.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-12-2017 at 15:25.
EFFx is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-12-2017 , 15:33   Re: Thunder lenght
Reply With Quote #4

Then you better do a trace line instead get_user_aiming.
klippy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-12-2017 , 15:35   Re: Thunder lenght
Reply With Quote #5

I'm using knife for show that thunder, so it cannot be possible I guess.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-12-2017 at 15:44.
EFFx is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-12-2017 , 15:43   Re: Thunder lenght
Reply With Quote #6

What? Just post your whole code, I can't figure out when you actually want it to appear.
klippy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-12-2017 , 15:52   Re: Thunder lenght
Reply With Quote #7

PHP Code:
register_forward(FM_CmdStart"forward_FM_CmdStart"
PHP Code:
public forward_FM_CmdStart(iduc_handleseed)
{
    if(
get_user_weapon(id) & CSW_KNIFE)
    {
        new 
iButtons get_uc(uc_handleUC_Buttons)
        new 
iOldButtons pev(idpev_oldbuttons)
    
        if(
iButtons IN_ATTACK && !(iOldButtons IN_ATTACK))
        {
            new 
iTargetiBody
            get_user_aiming
(idiTargetiBody170)
            
            new 
iOrigin[3]
            
get_user_origin(idiOrigin0)
            
            if(
pev_valid(iTarget))
            {    
                new 
iTargetOrigin[3]
                
get_user_origin(iTargetiTargetOrigin0)
                
                
CreateThunder(iOriginiTargetOrigin)
            }    
            else
            {
                
// Thats what I was trying, but doesn't worked
                
new iEntOrigin[3]
                
get_tr2(iTargetTR_vecEndPosiEntOrigin)
                
                
CreateThunder(iOriginiEntOrigin)
            }
            
iButtons &= ~IN_ATTACK
            set_uc
(uc_handleUC_ButtonsiButtons)
        }
    }

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-12-2017 at 15:52.
EFFx is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 03-12-2017 , 15:55   Re: Thunder lenght
Reply With Quote #8

myb as a simple u can do it like this ?

PHP Code:
        new origin[3], position[3];
    
get_user_origin(id,origin3)
    
get_user_origin(id,position0)
    
    if(
get_distance(originposition) < 60)
    { 
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-12-2017 , 16:04   Re: Thunder lenght
Reply With Quote #9

I want not a X distance for show the thunder, if I hit the shot, will show it between me and my enemy. If I miss, it show a small thunder.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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