AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me with a daylight changer plugin, i guess it's simple. (https://forums.alliedmods.net/showthread.php?t=84618)

PauliusBa 01-29-2009 02:21

Help me with a daylight changer plugin, i guess it's simple.
 
This is a simple plugin which changes the lighting of the level depending on time:
Code:

#include <amxmodx>
#include <engine>
#include <string>
public updatelights()
{
    if ( !get_cvar_num("sv_hourlight") )
        return PLUGIN_CONTINUE
    new szHours[2]
    new iHours
    new szLights[2] = "m"
    get_time("%H", szHours, 2)
    iHours = str_to_num(szHours)
    switch(iHours)
    {
        case 0:szLights = "m"
        case 1:szLights = "i"
        case 2:szLights = "e"
        case 3:szLights = "b"
        case 4:szLights = "e"
        case 5:szLights = "i"
        case 6:szLights = "m"
        case 7:szLights = "m"
        case 8:szLights = "m"
        case 9:szLights = "m"
        case 10:szLights = "m"
        case 11:szLights = "m"
        case 12:szLights = "m"
        case 13:szLights = "m"
        case 14:szLights = "m"
        case 15:szLights = "m"
        case 16:szLights = "m"
        case 17:szLights = "m"
        case 18:szLights = "m"
        case 19:szLights = "m"
        case 20:szLights = "m"
        case 21:szLights = "m"
        case 22:szLights = "m"
        case 23:szLights = "m"
        default:szLights = "m"
    }
    set_lights(szLights)
    return PLUGIN_CONTINUE
}
public plugin_init()
{
    register_plugin("HourLight","2.0","Downtown1")
    register_cvar("sv_hourlight", "1")
    set_task(120.0, "updatelights", 0, "", 0, "b")
    set_task(5.0, "updatelights", 0, "", 0, "c") 
    return PLUGIN_CONTINUE
}

I would like to make a set_task with "c" flag (pretty much like that set_task with 5.0 seconds from map start I made) which would start a "public skyname_change" thing which would set server's "sv_skyname" to "space" if "sz_Lights" is a, b or c, otherwise it would just skip this step.

Lots of karma for helpers :crab:


All times are GMT -4. The time now is 01:45.

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