Raised This Month: $ Target: $400
 0% 

Taking temporary damage from nothing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hattfield
Junior Member
Join Date: Oct 2013
Old 11-09-2013 , 10:03   Taking temporary damage from nothing
Reply With Quote #1

Code:
public damage_taking(ent)
{
    if(is_valid_ent(ent))
    {
        for(new i = 0; i < get_maxplayers(); i++)
        {    
            if(is_user_alive(i) && entity_range(ent, i) <= 100.0)
            {
                ExecuteHam(Ham_TakeDamage, i, 0, i, 10, DMG_BULLET)
            }
        }
    }
}
It works for all players, but i want it works only for one player.
Thanks.
hattfield is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-09-2013 , 12:40   Re: Taking temporary damage from nothing
Reply With Quote #2

Then don't loop through all the players.
__________________
fysiks is online now
hattfield
Junior Member
Join Date: Oct 2013
Old 11-10-2013 , 10:59   Re: Taking temporary damage from nothing
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Then don't loop through all the players.
Code:
            if(is_user_alive(i) && entity_range(ent, i) <= 100.0)
            {
                ExecuteHam(Ham_TakeDamage, i, 0, i, 10, DMG_BULLET)
            }
If i do like this - it doesn't compiles.

Last edited by hattfield; 11-10-2013 at 11:01.
hattfield is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-10-2013 , 13:22   Re: Taking temporary damage from nothing
Reply With Quote #4

Yeah because "i" is undefined. Attach your whole plugin and explain what you are trying to do.
__________________
fysiks is online now
hattfield
Junior Member
Join Date: Oct 2013
Old 11-10-2013 , 10:43   Re: Taking temporary damage from nothing
Reply With Quote #5

for(new i = 0; i < get_maxplayers(); i++)

dont' know how to make it
hattfield is offline
hattfield
Junior Member
Join Date: Oct 2013
Old 11-10-2013 , 14:39   Re: Taking temporary damage from nothing
Reply With Quote #6

Finished.

Last edited by hattfield; 11-11-2013 at 12:22.
hattfield 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 23:22.


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