Raised This Month: $ Target: $400
 0% 

[SLOVED] Grenade plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KillerMasa
Senior Member
Join Date: May 2012
Old 06-13-2012 , 15:26   [SLOVED] Grenade plugin
Reply With Quote #1

hi there,
i have grenade_enhancer plugin, and my problem is when i thorw grenade the grenade hit me [take damage and i die] i have zombie infection server, and when you thorw zombies with grenade
you die also, someone can fix it? i want the grenade do not kill yourself,

i already added this "if(!attacker || !victim)" but this not help,
it take damage on you when u thorw HE grenade.

PHP Code:
#include <amxmodx>
#include <csx>
new 
toggle_plugin,toggle_power,toggle_type,
toggle_flash,toggle_shake,toggle_display,
toggle_trail,trail_color;
new 
g_MsgSync,g_trail,spower;
public 
plugin_init()
{
 
register_plugin("Grenade Enhancer","1.2","anakin_cstrike");
 
toggle_plugin register_cvar("grenade_enhancer","1");
 
toggle_flash register_cvar("grenade_enhancer_screenflash","1");
 
toggle_display register_cvar("grenade_enhancer_display","1");
 
toggle_trail register_cvar("grenade_enhancer_trail","1");
 
toggle_shake register_cvar("grenade_enhancer_shake","1");
 
toggle_power register_cvar("grenade_enhancer_damage","500");
 
toggle_type register_cvar("grenade_enhancer_damagetype","2");
 
trail_color register_cvar("grenade_enhancer_trailcolor","255000000");
 
spower get_pcvar_num(toggle_power);
 
g_MsgSync CreateHudSyncObj();
}
public 
plugin_precache()
 
g_trail precache_model("sprites/smoke.spr");
public 
client_damage(attacker,victim,damage,wpnindex,hitplace,TA)
{
 if(
get_pcvar_num(toggle_plugin) != 1)
  return 
PLUGIN_CONTINUE;
 if(!
attacker || !victim)
  return 
PLUGIN_CONTINUE;
 if(
wpnindex != CSW_HEGRENADE)
  return 
PLUGIN_CONTINUE;
 
 switch(
get_pcvar_num(toggle_type))
 {
  case 
0user_slap(victim,spower,0);
  case 
1user_slap(victim,spower,1);
  case 
2user_slap(victim,spower,2);
  default: 
user_slap(victim,spower,2);
 }
 if(
get_pcvar_num(toggle_flash) == 1)
 {
  if(
is_user_connected(victim) && !is_user_bot(victim))
   
Fade(victim,255,0,0,170);
 }
 if(
get_pcvar_num(toggle_shake) == 1)
 {
  if(
is_user_connected(victim) && !is_user_bot(victim))
   
Shake(victim);
 }
 if(
get_pcvar_num(toggle_display) == 1)
 {
  new 
sdamage damage spower;
  
set_hudmessage(random(255),random(255),random(255), 0.030.3006.012.0);
  
ShowSyncHudMsg(victim,g_MsgSync,"%i",sdamage);
 }
 return 
PLUGIN_CONTINUE;
}
public 
grenade_throw(id,gid,wid)
{
 if(
get_pcvar_num(toggle_plugin) != 1)
  return 
PLUGIN_CONTINUE;
 if(
get_pcvar_num(toggle_trail) != 1
  return 
PLUGIN_CONTINUE;
 if(
wid != CSW_HEGRENADE)
  return 
PLUGIN_CONTINUE;
 
 static 
rgb,color[10];
 
get_pcvar_string(trail_colorcolor9);
 new 
str_to_num(color);
 
1000000
 c 
%= 1000000 
 g 
1000
 b 
1000
 Follow
(gid,g_trail,10,5,r,g,b,195);
 return 
PLUGIN_CONTINUE;
}
Follow(entity,index,life,width,red,green,blue,alpha)
{
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
 
write_byte(TE_BEAMFOLLOW);
 
write_short(entity);
 
write_short(index);
 
write_byte(life);
 
write_byte(width);
 
write_byte(red);
 
write_byte(green);
 
write_byte(blue);
 
write_byte(alpha);
 
message_end();
}
Fade(index,red,green,blue,alpha)
{
 
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("ScreenFade"),{0,0,0},index);
 
write_short(6<<10);
 
write_short(5<<10);
 
write_short(1<<12);
 
write_byte(red);
 
write_byte(green);
 
write_byte(blue);
 
write_byte(alpha);
 
message_end();
}
Shake(index)
{
 
message_begin(MSG_ONE,get_user_msgid("ScreenShake"),{0,0,0},index);
 
write_short(1<<13);
 
write_short(1<<13);
 
write_short(1<<13);
 
message_end();


Last edited by KillerMasa; 07-19-2012 at 13:46.
KillerMasa is offline
Gooogle
Member
Join Date: Aug 2011
Old 06-13-2012 , 15:28   Re: Grenade plugin,
Reply With Quote #2

Code:
if( attacker == victim )
If the attacker attacks him or herself, the victim (attacker) will not get hurt.

Last edited by Gooogle; 06-13-2012 at 15:30.
Gooogle is offline
KillerMasa
Senior Member
Join Date: May 2012
Old 06-13-2012 , 15:42   Re: Grenade plugin,
Reply With Quote #3

Not work, i think the zombie infection mod is cause. because the change your team.

Last edited by KillerMasa; 06-13-2012 at 16:33.
KillerMasa is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-14-2012 , 08:38   Re: Grenade plugin,
Reply With Quote #4

The line if(!attacker || !victim) is not related to the grenade, as I'm assuming your using it to make sure the attacker and vitctim are both in fact players.

The final argument of client_damage() TA determines whether it was team damage or not, so you could also try checking that and returning PLUGIN_HANDLED.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 06-14-2012 at 08:39.
hornet is offline
KillerMasa
Senior Member
Join Date: May 2012
Old 06-14-2012 , 09:05   Re: Grenade plugin,
Reply With Quote #5

So what i add/change now?

Last edited by KillerMasa; 06-14-2012 at 09:06.
KillerMasa is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-14-2012 , 09:09   Re: Grenade plugin,
Reply With Quote #6

Well you could try what Gooogle said ( and return ):

Code:
if( attacker == victim )     return PLUGIN_HANDLED;

Or

Code:
if( TA == 1 )     return PLUGIN_HANDLED;
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
KillerMasa
Senior Member
Join Date: May 2012
Old 06-14-2012 , 09:22   Re: Grenade plugin,
Reply With Quote #7

the problem is clear
when you thorw HE grenade you dont die, but when someone is zombie and all other is CT you die when you thorw grenade,
can you make that only T who get damage? i mean grenade hit them.
EDIT: i tested this two code but not work, grenade still kill myself.

Last edited by KillerMasa; 06-25-2012 at 17:17.
KillerMasa is offline
Old 06-25-2012, 17:13
KillerMasa
This message has been deleted by YamiKaitou. Reason: wait 14 days until you bump
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 06:18.


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