AlliedModders

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

Apb hq 07-09-2018 16:45

Entity problem
 
Hi i have an issue with this code i want that pb bullets can go through teammates i have tried with this but there is a bug sometimes you can’t kill your opponents the bullets go through ennemies also
PHP Code:

if( get_user_teamowner ) == get_user_teament ) )
    
set_peventpev_solidSOLID_NOT ); 

Here is my function
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_teamowner ) == get_user_teament ) )
    
set_peventpev_solidSOLID_NOT );
        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 && pev(ent,pev_takedamage))
{
        
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;



Celena Luna 07-09-2018 17:53

Re: Entity problem
 
use SOLID_TRIGGER. It will execute Touch but will let the entity go through except wall.

Apb hq 07-10-2018 04:27

Re: Entity problem
 
Bro your code crashes my server

Code:

FATAL ERROR (shutting down) : SV_ClipToLinks: Trigger in clipping list
Segmentation fault core dumped


Celena Luna 07-10-2018 05:09

Re: Entity problem
 
I said using SOILD_TRIGGER when create the entity, not in that code

Apb hq 07-10-2018 05:44

Re: Entity problem
 
You are amazing bro thanks a lot :)

Apb hq 07-12-2018 09:45

Re: Entity problem
 
I am sorry for double post but i have noticed a new bug , when the player has a bad connection and gets stuck we can’t kill him the entities just go through him just like for the teammates
Do you have any idea why is this happening

EDIT : Photos of stucked players


Apb hq 08-01-2018 05:55

Re: Entity problem
 
Has someone an idea how to fix the issue from the photos , can maybe is_user_stuck help ?

Apb hq 08-27-2018 04:19

Re: Entity problem
 
Bump :)

Ghosted 08-27-2018 04:21

Re: Entity problem
 
Quote:

Originally Posted by Apb hq (Post 2612379)
Bump :)

https://forums.alliedmods.net/misc.php?do=showrules


All times are GMT -4. The time now is 12:50.

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