AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Taking temporary damage from nothing (https://forums.alliedmods.net/showthread.php?t=229526)

hattfield 11-09-2013 10:03

Taking temporary damage from nothing
 
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.

fysiks 11-09-2013 12:40

Re: Taking temporary damage from nothing
 
Then don't loop through all the players.

hattfield 11-10-2013 10:43

Re: Taking temporary damage from nothing
 
for(new i = 0; i < get_maxplayers(); i++)

dont' know how to make it

hattfield 11-10-2013 10:59

Re: Taking temporary damage from nothing
 
Quote:

Originally Posted by fysiks (Post 2058806)
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.

fysiks 11-10-2013 13:22

Re: Taking temporary damage from nothing
 
Yeah because "i" is undefined. Attach your whole plugin and explain what you are trying to do.

hattfield 11-10-2013 14:39

Re: Taking temporary damage from nothing
 
Finished.


All times are GMT -4. The time now is 23:22.

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