AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]+1/sec. (https://forums.alliedmods.net/showthread.php?t=94914)

One 06-17-2009 04:29

[SOLVED]+1/sec.
 
new my_number
my_number get per sec. +1 or +x..

dont wanna use task.

if this & this
set my_function +my_number
else my_function = xx

One 06-17-2009 05:46

Re: +1/sec.
 
SOLVED. SRY.
new g_speed_time 90
g_speed_time = g_speed_time + 1

if(g_speed_time >= 90 && g_speed_time <= 120)
{
set_vision(id, g_speed_time)
}
}
else
{
if(g_speed_time >= 120)
{
g_speed_time = 120
}
if(g_speed_time >= 90 && g_speed_time <= 400)
{
g_speed_time = g_speed_time -1
set_vision(id,g_speed_time)
}

biscuit628 06-17-2009 20:50

Re: +1/sec.
 
PHP Code:

new g_speed_time 90

public something(id)
{

    if(
g_speed_time >= 90 && g_speed_time <= 120)
    {
        
set_vision(idg_speed_time)
    }
    else
    {
        if(
g_speed_time 120)
        {
            
g_speed_time++
        }
        else
        {
            
g_speed_time--
            
set_vision(id,g_speed_time)
        }
    }



IneedHelp 06-17-2009 21:00

Re: +1/sec.
 
PHP Code:

if(g_speed_time >= 90 && g_speed_time <= 120

->

PHP Code:

if (90 <= g_speed_time <= 120


One 06-18-2009 02:44

Re: +1/sec.
 
Hmmm :-?? i got it so.

im to lame to change this. but if is there anything better, ill change :( any ideas?

PHP Code:

public fwdCmdStart(idiHandle)
{
    
    if (
something)
    {
        
g_speed_time g_speed_time 1
        
        
        
if(g_speed_time >= 90 && g_speed_time <= 120)
        {
            
set_vision(idg_speed_time)
        }
    
    }
         else
    {        
        if(
g_speed_time >= 120)
        {
            
g_speed_time 120
        
}
        if(
g_speed_time >= 90 && g_speed_time <= 400)
        {
            
g_speed_time g_speed_time -2
            set_vision
(id,g_speed_time)
        }
    }


edit : & this works perfectly.but the performance is imp. :P

[ --<-@ ] Black Rose 06-18-2009 05:06

Re: +1/sec.
 
What are you trying to do? I don't see why this would work.

One 06-18-2009 05:10

Re: +1/sec.
 
1 Attachment(s)
in demo ull see what i did :P

hleV 06-18-2009 05:24

Re: +1/sec.
 
Code:

if g_speed_time is less or equal to 120
{
        //
}
else if g_speed_time is more or equal to 120
{
        //
}

Why you add "equal" in both?

One 06-18-2009 05:35

Re: +1/sec.
 
cuz if i dont the vision got over 120 or get over -1 ... try it by ur self. to give by attack2 vision 90 to 120 & fom 120 to 90 back. i know this looks silly but i couldnt find other way to do this.

updated the demo, u can now the effect better.

hleV 06-18-2009 05:54

Re: +1/sec.
 
You check if it's equal in the first "if", and also in the second "if". If the speed time is 120, it will only go through the first "if" and wont touch the second "if". That's why you should only check ">" in the second "if" (else if).


All times are GMT -4. The time now is 15:36.

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