Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.20 KB | None | 0 0
  1. public fw_touch(bullet, ent)
  2. {
  3.     new class[20];
  4.     pev(bullet, pev_classname, class, 19);
  5.     if (!equali(class, "pbBullet"))
  6.         return FMRES_IGNORED;
  7.  
  8.     new Float:origin[3], class2[20], owner = pev(bullet, pev_owner), is_ent_alive = is_user_alive(ent);
  9.     pev(ent, pev_classname, class2, 19);
  10.     pev(bullet, pev_origin, origin);
  11.  
  12.     if (is_ent_alive)
  13.     {
  14.         if (owner == ent || pev(ent, pev_takedamage) == DAMAGE_NO)  
  15.             return FMRES_IGNORED;
  16.         if (get_user_team(owner) == get_user_team(ent))
  17.        
  18.             if (!get_pcvar_num(friendlyfire))
  19.                 return FMRES_IGNORED;
  20.                
  21.         new my_pbgun = user_has_pbgun(owner);
  22.         new damage = get_pcvar_num(damge);
  23.    
  24.         if (my_pbgun)
  25.         {
  26.             if (my_pbgun == 1)
  27.                 damage = 100;
  28.             else if(my_pbgun == 2 || my_pbgun == 3)
  29.                 damage = 100;
  30.             else if(my_pbgun == 4)
  31.                 damage = 100;
  32.             else if(my_pbgun == 5)
  33.                 damage = 100;
  34.             else if(my_pbgun == 6)
  35.                 damage = 100;
  36.             else if(my_pbgun == 7)
  37.                 damage = 100;
  38.             else if(my_pbgun == 8)
  39.                 damage = 100;
  40.             else if(my_pbgun == 9)
  41.                 damage = 100;
  42.             else if(my_pbgun == 10)
  43.                 damage = 100;
  44.         }
  45.  
  46.         ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(damage), 4098);
  47.     }
  48.  
  49.     if (!equali(class, class2))
  50.     {  
  51.         set_pev(bullet, pev_velocity, Float:{0.0, 0.0, 0.0});
  52.         set_pev(bullet, pev_classname, "pbPaint");
  53.         set_pev(bullet, pev_solid, 0);
  54.         set_pev(bullet, pev_movetype, 0);
  55.         engfunc(EngFunc_SetModel, bullet, "sprites/paintball.spr");
  56.  
  57.         new a, findpb = 0;
  58.         while (a++ < g_pbcount && !findpb)
  59.             if (g_paintballs[a] == bullet)
  60.                 findpb = g_pbstatus[a] = 2;
  61.  
  62.         remove_task(bullet);
  63.         remove_task(bullet+TASK_PB_RESET);
  64.  
  65.         if (get_pcvar_num(sound))
  66.         {
  67.             static wav[20];
  68.             formatex(wav, 20, is_ent_alive ? "player/pl_pain%d.wav" : "misc/pb%d.wav", is_ent_alive ? random_num(4,7) : random_num(1,4));
  69.             emit_sound(bullet, CHAN_AUTO, wav, 1.0, ATTN_NORM, 0, PITCH_NORM);
  70.         }
  71.  
  72.         new bool:valid_surface = (is_ent_alive || containi(class2, "door") != -1) ? false : true;
  73.         if (valid_surface)
  74.         {
  75.             paint_splat(bullet);
  76.             set_task(float(get_pcvar_num(blife)), "paint_reset", bullet+TASK_PB_RESET);
  77.         }
  78.         else
  79.             paint_reset(bullet+TASK_PB_RESET);
  80.  
  81.         return FMRES_HANDLED;
  82.     }
  83.  
  84.     return FMRES_IGNORED;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement