Raised This Month: $51 Target: $400
 12% 

- frags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-20-2009 , 16:28   - frags
Reply With Quote #1

If i killed when put command kill to console and kill of trigger_hurt, env_laser and other entity i get -1 frag. How fix this problem? I need that kills not recover for "suicide"
Attached Thumbnails
Click image for larger version

Name:	12.jpg
Views:	147
Size:	4.2 KB
ID:	55674  
selax is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 12-20-2009 , 18:04   Re: - frags
Reply With Quote #2

You could block the player_death event, or add code in that event that give you 1 point restore that lost point.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)
rhelgeby is offline
Send a message via MSN to rhelgeby
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 12-22-2009 , 05:20   Re: - frags
Reply With Quote #3

Не совсем понял, что ты хочешь сделать. За самоубийство через 'kill' не должны отниматься очки? Или что-то другое?

en :: I don't get well what are you trying to do. Do you want to prevent 'kill' from reducing frags? Or is it something else?
__________________
Lord Canistra is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-22-2009 , 14:26   Re: - frags
Reply With Quote #4

Ну фишка в том, если самоубиваешся, то у тебя отнимается очко, ну вот оно не должно отниматься...

en: When suicide frag deleted, i want frag not deleted

Last edited by selax; 12-22-2009 at 14:37.
selax is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 12-22-2009 , 16:24   Re: - frags
Reply With Quote #5

Get player deaths :: GetEntProp(victim, Prop_Data, "m_iDeaths")
Set player deaths :: SetEntProp(victim, Prop_Data, "m_iDeaths", deathcount)

Поставь хук на событие (эвент) player_death. Самоубийство определить просто - userid и attacker в событии в этом случае равны id игрока.

en :: Add hook to player_death event. Suicide is easy to detect, for player will be both 'userid' and 'attacker' in this case.
__________________
Lord Canistra is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-23-2009 , 04:20   Re: - frags
Reply With Quote #6

I write this, but it don't work:
Quote:
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new victim = GetEventInt(event, "userid")
new attacker = GetEventInt(event, "attacker")
new victim_id = GetClientOfUserId(victim)
new attacker_id = GetClientOfUserId(attacker)

if (victim_id == attacker_id)
{
new Score = GetClientFrags(victim_id)+1;
SetEntProp(victim_id, Prop_Data, "m_iFrags", Score);
}
}
selax is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 12-23-2009 , 07:05   Re: - frags
Reply With Quote #7

Hook must be registered with HookEvent() in order to work.

HookEvent(const String:name[], EventHook:callback, EventHookMode:mode=EventHookMode_Post);

In your case :: HookEvent("player_death", Event_PlayerDeath)
__________________
Lord Canistra is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-23-2009 , 07:57   Re: - frags
Reply With Quote #8

Да естественно я хук зарегестрировал этот, не работает...
selax is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 12-23-2009 , 09:06   Re: - frags
Reply With Quote #9

Что именно не срабатывает?
И дублируй сообщения на английском, даже если это трудно. На этом форуме бывают люди из разных стран, но между собой все общаются на английском. Так ты сможешь получить больше поддержки.

I can't test the code at the moment.
Add printout in the function :: PrintToChatAll("Client %i died, attacker id %i", victim_id, attacker_id)
and see what will come out.
__________________
Lord Canistra is offline
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-23-2009 , 12:23   Re: - frags
Reply With Quote #10

How do this?
attacker_id = victim_id or attacker_id == 0

Last edited by selax; 12-23-2009 at 12:26.
selax 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 00:01.


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