Raised This Month: $ Target: $400
 0% 

log_kill and frags problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
spunko
Senior Member
Join Date: Jun 2005
Location: Ecuador
Old 12-03-2006 , 15:46   log_kill and frags problems
Reply With Quote #1

hi.. the problem with this code is that when you kill someone, it sets the frags to you (1 / 0) but the victim gets (-1 / 1).. so if you kill him again u will have (2 / 0) and the victim (-2 / 2)

I dunno what the problem is.. can any one help me with this?
PHP Code:
public event_damageid ) {
 
 new 
victim_id id;
 if( !
is_user_connectedvictim_id ) ) return PLUGIN_CONTINUE
 
new dmg_take read_data);
 new 
dmgtype read_data);
 new 
Float:multiplier get_pcvar_float(CVAR_DAMAGE);
 new 
Float:damage dmg_take multiplier;
 new 
health get_user_healthvictim_id );
 
 new 
iWeapIDattacker_id get_user_attackervictim_idiWeapID );
 
 if( !
is_user_connectedattacker_id ) || !is_user_alivevictim_id ) ) {
  return 
PLUGIN_HANDLED
 
}
 
 if( 
iWeapID == CSW_KNIFE && knife_model[attacker_id] == ) {
 
  if( 
floatround(damage) >= health ) {
   if( 
victim_id == attacker_id ) {
    return 
PLUGIN_CONTINUE
    
}else{
    
log_killattacker_idvictim_id"knife");
   }
 
   return 
PLUGIN_CONTINUE
   
}else {
   if( 
victim_id == attacker_id ) return PLUGIN_CONTINUE
 
   fakedamage
victim_id"weapon_knife"damagedmgtype );
  }
 }
 return 
PLUGIN_CONTINUE
}
 
stock log_kill(killervictimweapon[],headshot) {
 
user_silentkillvictim );
 
 
message_beginMSG_ALLget_user_msgid"DeathMsg" ), {0,0,0}, );
 
write_bytekiller );
 
write_bytevictim );
 
write_byteheadshot );
 
write_stringweapon );
 
message_end();
 
 new 
kfrags get_user_fragskiller );
 
set_user_fragskillerkfrags );
 new 
vfrags get_user_fragsvictim );
 
set_user_fragsvictimvfrags );
 
 return  
PLUGIN_CONTINUE

__________________
spunko is offline
Send a message via MSN to spunko
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-03-2006 , 23:00   Re: log_kill and frags problems
Reply With Quote #2

probably because you get the victim's frags - 1 when he died.
new vfrags = get_user_frags( victim );
set_user_frags( victim, vfrags - 1 );
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
spunko
Senior Member
Join Date: Jun 2005
Location: Ecuador
Old 12-03-2006 , 23:24   Re: log_kill and frags problems
Reply With Quote #3

ok.. but what should i put then?
PHP Code:
new vfrags get_user_fragsvictim );
set_user_fragsvictimvfrags ); 
if i do that, i think it wont regioster the kill
__________________
spunko is offline
Send a message via MSN to spunko
The Specialist
BANNED
Join Date: Nov 2006
Old 12-04-2006 , 12:36   Re: log_kill and frags problems
Reply With Quote #4

why would you take kills from a person becasue they died ?
The Specialist is offline
Send a message via AIM to The Specialist
spunko
Senior Member
Join Date: Jun 2005
Location: Ecuador
Old 12-04-2006 , 19:40   Re: log_kill and frags problems
Reply With Quote #5

well i thought that too.. so i did this and the pluing still have the same problem..
PHP Code:
stock log_kill(killervictimweapon[],headshot) {
 
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
 
user_silentkillvictim )
 
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
 
 
message_beginMSG_ALLget_user_msgid"DeathMsg" ), {0,0,0}, );
 
write_bytekiller );
 
write_bytevictim );
 
write_byteheadshot );
 
write_stringweapon );
 
message_end();
 
 new 
kfrags get_user_fragskiller );
 
set_user_fragskillerkfrags );
 
//new vfrags = get_user_frags( victim );
 //set_user_frags( victim, vfrags++ );
 
 
return  PLUGIN_CONTINUE

__________________
spunko is offline
Send a message via MSN to spunko
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-04-2006 , 22:51   Re: log_kill and frags problems
Reply With Quote #6

this is not related to your problem, but you don't have to block DeathMsg when you use user_silentkill, it will do that for u.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
spunko
Senior Member
Join Date: Jun 2005
Location: Ecuador
Old 12-04-2006 , 23:30   Re: log_kill and frags problems
Reply With Quote #7

well look at the first post, it isn't with the block DeathMsg.. i did that to see if that helps cuz i saw some codes with that.. but guess what?? it didnt make any difference.. the problem is still there and i really dunno how to fix it, also i don't have much time cuz im working like crazy..

I hope someone could help me with this..
__________________
spunko is offline
Send a message via MSN to spunko
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-05-2006 , 07:16   Re: log_kill and frags problems
Reply With Quote #8

The problem you're having is because the scoreboard doesn't update after set_frags...
here's an example i used for ESF:

Code:
new g_iMsgScoreInfo = get_user_msgid( "ScoreInfo" )
public AddScore(id){
new playerClass = entity_get_int(id, EV_INT_playerclass)
new team[32]
get_user_team(id,team,31)
message_begin(MSG_ALL,g_iMsgScoreInfo)
write_byte(id)
write_short(get_user_frags(id))
write_short(get_user_deaths(id))
write_short(0)
write_short(playerClass)
if( containi( team, "Good" ) != -1 ) { 
write_short(1) //color of the player line
}else if( containi( team, "Evil" ) != -1 ) {
write_short(2)
}
message_end()
}
Note that this example is based on ESF, the message could be different on CT
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.

Last edited by dutchmeat; 12-05-2006 at 17:34.
dutchmeat is offline
spunko
Senior Member
Join Date: Jun 2005
Location: Ecuador
Old 12-05-2006 , 17:25   Re: log_kill and frags problems
Reply With Quote #9

going to see if it works.. thanx..
__________________
spunko is offline
Send a message via MSN to spunko
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-05-2006 , 17:33   Re: log_kill and frags problems
Reply With Quote #10

Karma karma karma, spamming for karma hehe
but like i said, you might have to find the right arguments for CS.

btw, " g_iMsgScoreInfo " = get_user_msgid( "ScoreInfo" )
fixed my post
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat 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 06:52.


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