Raised This Month: $ Target: $400
 0% 

Fix error pev


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Apb hq
Senior Member
Join Date: Apr 2014
Old 05-22-2016 , 05:56   Fix error pev
Reply With Quote #1

Can someone help me to fix those errors
Error:
Code:
L 05/22/2016 - 11:43:03: [AMXX] Displaying debug trace (plugin "guns_new.amxx")
L 05/22/2016 - 11:43:03: [AMXX] Run time error 10: native error (native "pev")
L 05/22/2016 - 11:43:03: [AMXX]    [0] guns_new.sma::fw_touch (line 300)
Here is the code
PHP Code:
public fw_touch(bulletent)
{
    new class[
20];
    
pev(bulletpev_classname, class, 19);
    if (!
equali(class, "pbBullet"))
        return 
FMRES_IGNORED;

    new 
Float:origin[3], class2[20], owner pev(bulletpev_owner), is_ent_alive is_user_alive(ent);
    
pev(entpev_classnameclass219);
    
pev(bulletpev_originorigin);

    if (
is_ent_alive)
    {
        if (
owner == ent || pev(entpev_takedamage) == DAMAGE_NO)
            return 
FMRES_IGNORED;
        if (
get_user_team(owner) == get_user_team(ent))
            if (!
get_pcvar_num(friendlyfire))
                return 
FMRES_IGNORED;

        
ExecuteHam(Ham_TakeDamageentownerownerfloat(get_pcvar_num(damge)), 4098);
    }

    if (!
equali(class, class2))
    {    
        
set_pev(bulletpev_velocityFloat:{0.00.00.0});
        
set_pev(bulletpev_classname"pbPaint");
        
set_pev(bulletpev_solid0);
        
set_pev(bulletpev_movetype0);
        
engfunc(EngFunc_SetModelbullet"sprites/paintball.spr");

        new 
afindpb 0;
        while (
a++ < g_pbcount && !findpb)
            if (
g_paintballs[a] == bullet)
                
findpb g_pbstatus[a] = 2;

        
remove_task(bullet);
        
remove_task(bullet+TASK_PB_RESET);

        if (
get_pcvar_num(sound))
        {
            static 
wav[20];
            
formatex(wav20is_ent_alive "player/pl_pain%d.wav" "misc/pb%d.wav"is_ent_alive random_num(4,7) : random_num(1,4));
            
emit_sound(bulletCHAN_AUTOwav1.0ATTN_NORM0PITCH_NORM);
        }

        new 
bool:valid_surface = (is_ent_alive || containi(class2"door") != -1) ? false true;
        if (
pev(entpev_health) && !is_ent_alive)
        {
            
ExecuteHam(Ham_TakeDamageentownerownerfloat(pev(entpev_health)), 0);
            
valid_surface false;
        }
        if (
valid_surface)
        {
            
paint_splat(bullet);
            
set_task(float(get_pcvar_num(blife)), "paint_reset"bullet+TASK_PB_RESET);
        }
        else
            
paint_reset(bullet+TASK_PB_RESET);

        return 
FMRES_HANDLED
    }

    return 
FMRES_IGNORED;

Apb hq is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-22-2016 , 06:24   Re: Fix error pev
Reply With Quote #2

Before you start doing something you shall check if entity is valid , just put this before new class:

if(!pev_valid(bullet) || !pev_valid(ent))
return FMRES_IGNORED;
siriusmd99 is offline
Apb hq
Senior Member
Join Date: Apr 2014
Old 05-22-2016 , 07:51   Re: Fix error pev
Reply With Quote #3

Man i have done this before but i get this bug on the server look at those pictures you should see a paint splat not paintball balls blocked in wall
Your edit bug:


What i should obtain when i shoot at the wall

Last edited by Apb hq; 05-22-2016 at 15:16.
Apb hq is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-22-2016 , 15:56   Re: Fix error pev
Reply With Quote #4

Sorry, i was confused. Wall will return true...

Put this only :

Quote:
if(!pev_valid(bullet))
return FMRES_IGNORED;
siriusmd99 is offline
Apb hq
Senior Member
Join Date: Apr 2014
Old 05-22-2016 , 16:42   Re: Fix error pev
Reply With Quote #5

Thanks man problem solved
Apb hq is offline
Reply


Thread Tools
Display Modes

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 18:44.


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