Raised This Month: $ Target: $400
 0% 

Special task?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 03-31-2011 , 11:41   Special task?
Reply With Quote #1

I want to have a function, which does in a small way change the light of the map, I thought about using set_task with that, but then, I would need to make all the letters from a-z (set_lights) with set_task, is there another easy way?
bibu is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-31-2011 , 11:59   Re: Special task?
Reply With Quote #2

I don't understand what you mean...
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
bibu
Veteran Member
Join Date: Sep 2010
Old 03-31-2011 , 12:27   Re: Special task?
Reply With Quote #3

If I want that the light should go slightly to dark, something like that:

PHP Code:
set_task(2.0light_change_m)

public 
light_change_m()
{
     
set_lights("m")
     
set_task(0.5light_change_l)

And so on, doing it like this would be stupid I think, hope you understood me now.
bibu is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-31-2011 , 13:10   Re: Special task?
Reply With Quote #4

I got it now, will think about this.

EDIT: This works, but it sets the light to the brighest first.
Maybe you can work with this:

PHP Code:
#include <amxmodx>
#include <engine>

#pragma semicolon    1

#define TASK_LIGHT     4841

new const g_szAlphabet[][] =
{
    
"""a""b""c""d""e""f""g""h""i""j""k""l""m",    
    
"n""o""p""q""r""s""t""u""v""w""x""y""z"
};

new 
g_iLightLvl;

public 
plugin_init()
    
register_clcmd("say /changelights""CmdChangeLights");
    

public 
CmdChangeLights(id)
{
    
g_iLightLvl sizeof(g_szAlphabet);
    
    
set_task(0.1"TaskChangeLights"TASK_LIGHT, .flags "b");
}
    
public 
TaskChangeLights()
{
    if(!--
g_iLightLvl)
    {
        if(!
task_exists(TASK_LIGHT))
            
g_iLightLvl sizeof(g_szAlphabet);
        
        else
            
remove_task(TASK_LIGHT);
    }
    
    
set_lights(g_szAlphabet[g_iLightLvl]);

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 03-31-2011 at 13:28.
drekes is offline
Send a message via MSN to drekes
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 03-31-2011 , 22:07   Re: Special task?
Reply With Quote #5

I don't really understand what you are trying to do but, just to offer more options:

You can use looped sequenced lights:
Code:
set_lights("aaaaaaaaaaabcdeeeeeefg")
It holds on light A for some time then goes to B,C and D then holds some time on E and then goes to F an G and then again from A... I don't really know how to end the loop but you can just set a task and set the lights to a fixed value.


Or if you just want to increase or decrease lightning:
Code:
#include <amxmodx>
#include <engine>

new const g_szLights[][] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" }

new g_iLight

public plugin_init()
{
    //g_iLight = 12 // I don't remember how to get the light level
}

stock adjustLights(iVal)
{
    if(iVal == 0)
    {
        set_lights("#OFF")
        //g_iLight = -1 // I don't remember how to get the light level
        return
    }

    g_iLight = clamp(g_iLight + iVal, 0, sizeof g_szLights)

    set_lights(g_szLights[g_iLight])

    client_print(0, print_chat, "[debug] %s%d lights - light is now %s ", (iVal > 0 ? "+" : ""), iSet, g_szLights[g_iLight])
}
Use adjustLights(value) to adjust the lights, give it positive or negative values, 0 resets light level.
Ex:
adjustLights(1) increases the light level by 1
adjustLights(-5) decreases the light level by 5
adjustLights(0) resets light level to map default.
__________________
Hunter-Digital 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 14:41.


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