View Single Post
dalto
Veteran Member
Join Date: Jul 2007
Old 08-19-2007 , 22:12   Re: Napalm Grenades!
Reply With Quote #4

I think what he is saying is not that there is something wrong with your code, but that it might not be doing what you intended it to do.


Code:
        if(DmgDone <= 30)
        {
            IgniteEntity(client,3.0);
        }else if(DmgDone > 31)
        {
            IgniteEntity(client,6.0);
        }else if(DmgDone > 51)
        {
            IgniteEntity(client,9.0);
        }else if (DmgDone > 71)
        {
            IgniteEntity(client,12.0);
        }
With this code, it is not possible to ever get to the if(DmgDone > 51) or if (DmgDone > 71).

Because once it gets to if(DmgDone > 31), it finds a match and stops.

You might, instead consider doing something like this:
Code:
        if(DmgDone <= 30)
        {
            IgniteEntity(client,3.0);
        }else if(DmgDone > 31 && DmgDone <= 51)
        {
            IgniteEntity(client,6.0);
        }else if(DmgDone > 51 && DmgDone <= 71)
        {
            IgniteEntity(client,9.0);
        }else if (DmgDone > 71)
        {
            IgniteEntity(client,12.0);
        }
It will work either way, it is just a question of what you are trying to accomplish.
dalto is offline