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

- frags


Post New Thread Reply   
 
Thread Tools Display Modes
selax
AlliedModders Donor
Join Date: Apr 2008
Location: Moscow
Old 12-23-2009 , 12:43   Re: - frags
Reply With Quote #11

Yes! i write this!
Its 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)
new Score = GetClientFrags(victim_id);

if (victim_id == attacker_id)
{
SetEntProp(victim_id, Prop_Data, "m_iFrags", Score + 1);
}
else if (attacker_id == 0)
{
SetEntProp(victim_id, Prop_Data, "m_iFrags", Score + 1);
}
}
selax is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 12-23-2009 , 13:18   Re: - frags
Reply With Quote #12

nice! just to show you a more efficient way to do it, i edited your post.
PHP Code:
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim_id GetClientOfUserId(GetEventInt(event"userid"));
    new 
attacker_id GetClientOfUserId(GetEventInt(event"attacker"));
    if (
attacker_id == || victim_id == attacker_id)
    {
        
SetEntProp(victim_idProp_Data"m_iFrags"GetClientFrags(victim_id) + 1);
    }

__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 12-23-2009 , 19:31   Re: - frags
Reply With Quote #13

Quote:
attacker_id == 0
0 here means worldspawn? Death caused by it isn't counted as suicide, is it? I mean, it won't reduce frags, so there is no need to increase them.
__________________
Lord Canistra is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 12-23-2009 , 23:03   Re: - frags
Reply With Quote #14

Yes, index 0 is the world/map. Attacker will be 0 if the player died from physics damage like doors, fire, etc.
__________________
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
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 10:45.


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