AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Darkness. (https://forums.alliedmods.net/showthread.php?t=101679)

Mr.Noobie 08-26-2009 03:37

Darkness.
 
Does anyone know what wrong with this plugin ?

It works. But didn't work correctly.

I want to make it like after the 60 second the sky change to darkness like e - d - b - a then stop functioning.

My problem is the after the "a" the function repeat itself. I know there is a set_task( TIME_DELAY, "Darkness", Count ), But i try to remove_task( 0 ) Still it didn't remove task.

PHP Code:

#include <amxmodx> 
#include <engine>
 
#define TIME_DELAY 5.0
 
public plugin_init( ) 

        
register_plugin"Darkness""1.0""Mr.Noobie" )
        
set_task60.0"Darkness"0__"b" 
}
 
public 
DarknessCount )
{
    if ( 
Count<)
    {
        switch( 
Count )
        {
            case 
0set_lights"e" )
            case 
1set_lights"d" )
            case 
2set_lights"b" )
            case 
3set_lights"a" )
        }
        
Count++
        
set_taskTIME_DELAY"Darkness"Count )
        
remove_task
    }



Alucard^ 08-26-2009 05:31

Re: Darkness.
 
set_task

I think your problem is the flag that you asigned to the task.

Quote:

-- "b" - Loop task infinitely

xPaw 08-26-2009 06:29

Re: Darkness.
 
#8

Mr.Noobie 08-26-2009 10:21

Re: Darkness.
 
Quote:

Originally Posted by xPaw (Post 913382)
PHP Code:

#include <amxmodx> 
#include <engine>
 
new g_iCount;
 
#define TIME_DELAY 5.0
 
public plugin_init( ) {
    
register_plugin"Darkness""1.0""Mr.Noobie" );
    
set_task60.0"Darkness" );
}
 
public 
Darkness( ) {
    if ( 
g_iCount ) {
        switch( 
g_iCount ) {
            case 
0set_lights"e" );
            case 
1set_lights"d" );
            case 
2set_lights"b" );
            case 
3set_lights"a" );
        }
 
        
g_iCount++;
        
set_taskTIME_DELAY"Darkness" );
    }



Still it like when the light is "a" it will suddenly change to "e" then become "a" again. 1 second.

I want it like after e - d - b - a then the set task will stop functioning.

Alucard^ 08-26-2009 18:42

Re: Darkness.
 
PHP Code:

#include <amxmodx>  
#include <engine> 

new g_iCount
  
public 
plugin_init( ) { 
    
register_plugin"Darkness""1.0""Mr.Noobie" ); 
    
set_task60.0"Darkness" ); 


public 
Darkness( ) { 
    if ( ++
g_iCount ) { 
        switch( 
g_iCount ) { 
            case 
0set_lights"e" ); 
            case 
1set_lights"d" ); 
            case 
2set_lights"b" ); 
            case 
3set_lights"a" ); 
        } 
        
remove_task);
    } 


Rly i am not sure if my code is correctly so you have to try...

P.S: Obviusly set a short time to the task, so you can do a fast test, i dont think you want to wait 60 seconds ><

Exolent[jNr] 08-26-2009 22:25

Re: Darkness.
 
PHP Code:

    if ( ++g_iCount ) { 
        switch( 
g_iCount ) { 

:arrow:
PHP Code:

    if ( g_iCount ) { 
        switch( 
g_iCount++ ) { 

That way, 0 will be used.

Mr.Noobie 08-27-2009 11:39

Re: Darkness.
 
Quote:

Originally Posted by Alucard^ (Post 913891)
PHP Code:

#include <amxmodx>  
#include <engine> 
 
new g_iCount
 
public 
plugin_init( ) { 
    
register_plugin"Darkness""1.0""Mr.Noobie" ); 
    
set_task60.0"Darkness" ); 

 
public 
Darkness( ) { 
    if ( ++
g_iCount ) { 
        switch( 
g_iCount ) { 
            case 
0set_lights"e" ); 
            case 
1set_lights"d" ); 
            case 
2set_lights"b" ); 
            case 
3set_lights"a" ); 
        } 
        
remove_task);
    } 


Rly i am not sure if my code is correctly so you have to try...

P.S: Obviusly set a short time to the task, so you can do a fast test, i dont think you want to wait 60 seconds ><

I try your codes. didn't work correctly meaning that when the light change to "e" it's stop doesn't e - d - b - a.

Quote:

Originally Posted by Exolent[jNr] (Post 914039)
PHP Code:

    if ( ++g_iCount ) { 
        switch( 
g_iCount ) { 

:arrow:
PHP Code:

    if ( g_iCount ) { 
        switch( 
g_iCount++ ) { 

That way, 0 will be used.

I also try to change but no use.

I trying this it works but the same problem.

PHP Code:

#include <amxmodx> 
#include <engine>
new Count
#define TIME_DELAY 3.0
public plugin_init( ) 

        
register_plugin"Darkness""1.0""Mr.Noobie" )
        
set_task30.0"Darkness" 
}
public 
Darkness( )
{
    if ( 
Count )
    {
        switch( 
Count++ )
        {
            case 
0set_lights"e" )
            case 
1set_lights"d" )
            case 
2set_lights"b" )
            case 
3set_lights"a" )
        }
        
set_taskTIME_DELAY"Darkness"Count )
        
remove_task)
    }
}

But after "a" can't remove_task the task keep like repeat.

I don'
t know how to sayCan someone try that code then you see what i meanLike suddenly flash


xPaw 08-27-2009 11:54

Re: Darkness.
 
Tested and works fine.

PHP Code:

#include <amxmodx> 
#include <engine>

new g_iCount;

#define TIME_DELAY 3.0
 
public plugin_init( ) {
    
register_plugin"Darkness""1.0""Mr.Noobie" );
    
set_task30.0"Darkness" );
}

public 
Darkness( ) {
    if ( 
g_iCount ) {
        switch( 
g_iCount++ ) {
            case 
0set_lights"e" );
            case 
1set_lights"d" );
            case 
2set_lights"b" );
            case 
3set_lights"a" );
        }
        
        
set_taskTIME_DELAY"Darkness" );
    }



Exolent[jNr] 08-27-2009 14:23

Re: Darkness.
 
PHP Code:

#include <amxmodx> 
#include <engine>

new g_iCount;

new const 
g_szLightSettings[ ][ ] = { "e""d""b""a" };

#define TIME_DELAY 3.0
 
public plugin_init( ) {
    
register_plugin"Darkness""1.0""Mr.Noobie" );
    
set_task30.0"Darkness" );
}

public 
Darkness( ) {
    
set_lightsg_szLightSettingsg_iCount ] );
    if ( ++
g_iCount sizeofg_szLightSettings ) ) {
        
set_taskTIME_DELAY"Darkness" );
    }



Mr.Noobie 08-28-2009 05:30

Re: Darkness.
 
Quote:

Originally Posted by xPaw (Post 914452)
Tested and works fine.

PHP Code:

#include <amxmodx> 
#include <engine>
 
new g_iCount;
 
#define TIME_DELAY 3.0
 
public plugin_init( ) {
    
register_plugin"Darkness""1.0""Mr.Noobie" );
    
set_task30.0"Darkness" );
}
 
public 
Darkness( ) {
    if ( 
g_iCount ) {
        switch( 
g_iCount++ ) {
            case 
0set_lights"e" );
            case 
1set_lights"d" );
            case 
2set_lights"b" );
            case 
3set_lights"a" );
        }
 
        
set_taskTIME_DELAY"Darkness" );
    }



I know it working fine.

The problem is after e - d - b - a still continue.

I want after e - d - b - a to stop functioning.


All times are GMT -4. The time now is 14:58.

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