AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   [ZP] Addon: Custom Lighting Levels !! Updated v1.3 !! (https://forums.alliedmods.net/showthread.php?t=117143)

abdul-rehman 01-29-2010 14:20

[ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!
 
1 Attachment(s)
[ZP] Addon: Custom Lighting Levels
[Updated to v1.3]



Description:
This simple, but yet useful plugin allows you to set different lighting levels for different rounds. It also allows you to set a custom lighting level when the round starts, thus allowing players to navigate through the map and find hiding spots before any game mode starts.

Credits:
- MeRcyLeZZ ---> For Obviously ZP 4.3
- G-Dog -------> Helped me in the early stages of this plugin

Change Log:
-v1.0 ===> Initial Release
-v1.1 ===> Optimized some code
-v1.2 ===> Fixed custom lighting not working on round start
-v1.3 ===> Rewrote the whole plugin

Note:
- You need to compile the sma file loacally
- Dont forget to read the plugins sma file for the description of cvars

4eRT 01-29-2010 14:31

Re: [ZP] Lighting At Start
 
upload sma only

Excalibur.007 01-29-2010 21:44

Re: [ZP]Addon: Lighting At Start
 
Lol? Changing on zp_lighting CVar. Useless.
But anyway, you used so many if and else, why not use switch? Or I'm wrong...

abdul-rehman 01-30-2010 01:30

Re: [ZP]Addon: Lighting At Start
 
I dont no how to use Switch...
And I just made it for fun
Im new at scripting

G-Dog 01-30-2010 03:09

Re: [ZP]Addon: Lighting At Start
 
Quote:

Originally Posted by Excalibur.007 (Post 1072352)
Lol? Changing on zp_lighting CVar. Useless.
But anyway, you used so many if and else, why not use switch? Or I'm wrong...

he's making it so it changes based on what the game mode is, and using arrays you can make this plugin alot smaller
PHP Code:

#include <amxmodx>
#include <zombieplague>

new const num_to_flag[7][] = { "a""b""c""d""f""m""z" }
new 
pcvar_light[8];
new 
cvar_plugin_onpointer_lighting;

#if !defined MODE_NONE
    #define MODE_NONE 0
#endif

public plugin_init()
{
    
register_plugin("[ZP] Lightings At Start""1.1""abdul@");
    
register_event("HLTV""event_round_start""a""1=0""2=0");

    
cvar_plugin_on register_cvar("zp_lights_at_start""1");
    
pcvar_light[MODE_NONE] = register_cvar("zp_starting_lights""5");
    
pcvar_light[MODE_INFECTION] = register_cvar("zp_infection_lighting""1"); 
    
pcvar_light[MODE_NEMESIS] = register_cvar("zp_nem_lighting""6");
    
pcvar_light[MODE_SURVIVOR] = register_cvar("zp_surv_lighting""2");
    
pcvar_light[MODE_SWARM] = register_cvar("zp_swarm_lighting""3");
    
pcvar_light[MODE_PLAGUE] = register_cvar("zp_plague_lighting""4");
    
pointer_lighting get_cvar_pointer("zp_lighting");
}

public 
event_round_start()
    
zp_round_started(MODE_NONE0);

public 
zp_round_started(modeunused)
    if ( 
get_pcvar_num(cvar_plugin_on) && MODE_NONE <= mode <= MODE_PLAGUE )
    {
        if ( 
mode == MODE_MULTI mode MODE_INFECTION;    //if you include a cvar to handle multi infection then you can remove this
        
        
set_light(get_pcvar_num(pcvar_light[mode]));
    }

set_light(level)
    
set_pcvar_string(pointer_lightinglevel "z" num_to_flag[level-1]);    //if for some reason someone sets a higher value then 7 we need to change so we don't get that annoying index out of bounds error 


abdul-rehman 01-30-2010 03:56

Re: [ZP]Addon: Lighting At Start
 
thnks G-Dog

Also can someone tell me the difference between "cvars" and "pcvars"

Javivi 01-30-2010 05:01

Re: [ZP]Addon: Lighting At Start
 
Quote:

Originally Posted by abdul-rehman (Post 1072529)
Well i dont even know the meaning of arrays
By the thnks G-Dog

Also can someone tell me the difference between "cvars" and "pcvars"

pcvars are faster.

EJ
cvar :
register_cvar(...

pcvar :
pcvar = register_cvar...
get_pcvar_num(pcvar)

G-Dog 01-30-2010 05:38

Re: [ZP] Addon: Lighting At Start || Updated v1.1 [Thnx G-Dog]
 
no problem

basically when using normal cvar natives the plugin has to search through the entire cvar memory table to locate the specified cvar to alter, while a pcvar is a pointer to the location in the memory table for the cvar. As a result pcvars are faster and less resource intensive. Same concept as pointers in c.

Szwedzik_PL 08-09-2010 14:48

Re: [ZP] Addon: Lighting At Start !! Updated v1.2 !!
 
Can you make a new version for Zombie Plague Advance 1.6 (assassin, sniper and armageddon mode) ?

georgik57 08-10-2010 04:03

Re: [ZP] Addon: Lighting At Start !! Updated v1.2 !!
 
i don't get it
what does this do?

Ryokin 08-10-2010 07:16

Re: [ZP] Addon: Lighting At Start !! Updated v1.2 !!
 
before the game mode starts , the light will be l or m .... when the game started the light back to default in cvar zp_lighting ...

abdul-rehman 12-13-2010 13:53

Re: [ZP] Addon: Lighting At Start !! Updated v1.2 !!
 
Since this was my first plugin in this forum, i forgot to update it :oops:
BTW plugin has been updated to v1.3

John301 12-16-2010 06:40

Re: [ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!
 
Heh A verry nice Plugin! Work GREAT! Thanks! Keep it up!

tropicana 10-27-2011 03:41

Re: [ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!
 
Hey i recently downloaded this plugin, but im having some issues. I basically want there to be light in the beginning of every round and as soon as infection starts, i want it to turn dark. The first round worked fine, but the next round after that, its completely dark, and a round after that, it doesn't go dark at all. Can someone help me?

TOM4S 10-31-2011 10:18

Re: [ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!
 
Not work but i am fix the plugin and now work's great thank's man :D

M@RSH@L 01-25-2014 04:55

Re: [ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!
 
Can anyone add new mods (Armagedon, Sniper, Assassin) to this plugin ??!

shayan123 03-15-2021 21:34

Re: [ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!
 
Can anyone add new mods (Armagedon, Sniper, Assassin) to this plugin ??!


All times are GMT -4. The time now is 20:03.

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