Raised This Month: $ Target: $400
 0% 

Crashed on explosion


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 01-27-2007 , 13:40   Crashed on explosion
Reply With Quote #1

I cant figure out why it is randomly crashing after the grenade has exploded.

PHP Code:

public grenade_throw(identwid)
{
    if(
fm_is_valid_ent(ent) && wid == CSW_HEGRENADE)
    {
        
set_pev(entpev_iuser11)
        
set_pev(entpev_iuser2get_user_team(id))
    }
}

public 
fwd_touch(entid)
{
    if(!
fm_is_valid_ent(ent) || !is_user_alive(id))
        return 
FMRES_IGNORED
    
    
new classname[STR_T]
    
pev(entpev_classnameclassname, (STR_T-1))
    
    if(
equali(classname"grenade"))
    {
        if(
pev(entpev_iuser1) != 1)
            return 
FMRES_IGNORED
        
        
if(get_user_team(id) == pev(entpev_iuser2))
            return 
FMRES_IGNORED
        
        set_pev
(entpev_iuser10)
        
set_pev(entpev_aimentid)
        
set_pev(entpev_movetypeMOVETYPE_FOLLOW)
        
set_pev(entpev_sequence0)
    }
    return 
FMRES_IGNORED
}

public 
fwd_think(ent)
{
    if(!
fm_is_valid_ent(ent))
        return 
FMRES_IGNORED
    
    
new classname[STR_T]
    
pev(entpev_classnameclassname, (STR_T-1))
    
    if(
equali(classname"grenade"))
    {
        if(
pev(entpev_iuser1) != 1)
            return 
FMRES_IGNORED
            
        
if(pev(entpev_flags) & FL_ONGROUND)
            return 
FMRES_IGNORED
        
        
static Float:nadeorigin[3]
        
pev(entpev_originnadeorigin)
        
        static 
players[32], num
        get_players
(playersnum"a")
        
        for(new 
0num; ++i)    
        {
            new 
id players[i]

            if(
get_user_team(id) == pev(entpev_iuser2))
                continue
                
            if(!
fm_is_ent_visible(entid))
                continue

            static 
Float:origin[3]
            
pev(idpev_originorigin)
            
            new 
Float:maxdistance get_pcvar_float(cvar_maxdis)
            new 
Float:distance get_distance_f(originnadeorigin)
            
            if(
distance maxdistance)
            {
                
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
                
write_byte(TE_BEAMFOLLOW)
                
write_short(ent)
                
write_short(sprite_trail)
                
write_byte(30)
                
write_byte(10)
                
write_byte(255)
                
write_byte(0)
                
write_byte(0)
                
write_byte(100)
                
message_end()
                
                
entity_set_follow(entidfloat(fm_get_speed(ent)))
            }
        }
    }
    return 
FMRES_IGNORED
}

stock entity_set_follow(entitytargetFloat:speed
{
    if(!
fm_is_valid_ent(entity) || !fm_is_valid_ent(target)) 
        return 
0

    
new Float:entity_origin[3], Float:target_origin[3]
    
pev(entitypev_originentity_origin)
    
pev(targetpev_origintarget_origin)

    new 
Float:diff[3]
    
diff[0] = target_origin[0] - entity_origin[0]
    
diff[1] = target_origin[1] - entity_origin[1]
    
diff[2] = target_origin[2] - entity_origin[2]

    new 
Float:length floatsqroot(floatpower(diff[0], 2.0) + floatpower(diff[1], 2.0) + floatpower(diff[2], 2.0))

    new 
Float:velocity[3]
    
velocity[0] = diff[0] * (speed length)
    
velocity[1] = diff[1] * (speed length)
    
velocity[2] = diff[2] * (speed length)

    
set_pev(entitypev_velocityvelocity)

    return 
1

__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 01-27-2007 , 16:35   Re: Crashed on explosion
Reply With Quote #2

It crashes as soon as it explodes, and not when you throw it right? Are there anything in the logs, error messages coming up, etc?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 01-27-2007 , 16:41   Re: Crashed on explosion
Reply With Quote #3

Yep when it explodes. No logs because it crashed to my desktop. Plus seems crashing randomly.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-27-2007 , 17:10   Re: Crashed on explosion
Reply With Quote #4

Comment out the entire "if(equali(classname,"grenade"))" block of your fwd_think and see if it still occurs.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 01-27-2007 , 17:55   Re: Crashed on explosion
Reply With Quote #5

Didnt help.

#edit
I think I track down the problem, I commented out my fwd_touch function and it stopped crashing.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 01-27-2007 at 18:28.
Cheap_Suit is offline
Super Fantastic
Junior Member
Join Date: Mar 2008
Old 06-26-2008 , 16:58   Re: Crashed on explosion
Reply With Quote #6

Sorry, I did not know that can not post here.
Not needed -karma.

Last edited by Super Fantastic; 10-05-2008 at 22:54.
Super Fantastic 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 22:25.


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