Raised This Month: $32 Target: $400
 8% 

[ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 01-29-2010 , 14:20   [ZP] Addon: Custom Lighting Levels !! Updated v1.3 !!
Reply With Quote #1

[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
Attached Files
File Type: sma Get Plugin or Get Source (zp_addon_lighting_levels.sma - 3667 views - 3.7 KB)

Last edited by abdul-rehman; 12-13-2010 at 13:55.
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
4eRT
Senior Member
Join Date: Jan 2009
Location: Russia, Saint-Petersburg
Old 01-29-2010 , 14:31   Re: [ZP] Lighting At Start
Reply With Quote #2

upload sma only
__________________
Not interested in CStrike modding anymore, but waht a HELL ?!
I am still 61% addicted to Counterstrike! What about you?
4eRT is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 01-29-2010 , 21:44   Re: [ZP]Addon: Lighting At Start
Reply With Quote #3

Lol? Changing on zp_lighting CVar. Useless.
But anyway, you used so many if and else, why not use switch? Or I'm wrong...
Excalibur.007 is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 01-30-2010 , 01:30   Re: [ZP]Addon: Lighting At Start
Reply With Quote #4

I dont no how to use Switch...
And I just made it for fun
Im new at scripting
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 01-30-2010 , 03:09   Re: [ZP]Addon: Lighting At Start
Reply With Quote #5

Quote:
Originally Posted by Excalibur.007 View Post
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 
__________________
If at first you don't succeed, then skydiving isn't for you.

Last edited by G-Dog; 01-30-2010 at 05:49. Reason: forgot that MODE_NONE was truncated, fixed so it'll compile with 4.3
G-Dog is offline
Send a message via AIM to G-Dog
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 01-30-2010 , 03:56   Re: [ZP]Addon: Lighting At Start
Reply With Quote #6

thnks G-Dog

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

Last edited by abdul-rehman; 12-14-2010 at 05:47.
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 01-30-2010 , 05:01   Re: [ZP]Addon: Lighting At Start
Reply With Quote #7

Quote:
Originally Posted by abdul-rehman View Post
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)
__________________
Javivi is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 01-30-2010 , 05:38   Re: [ZP] Addon: Lighting At Start || Updated v1.1 [Thnx G-Dog]
Reply With Quote #8

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.
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
Szwedzik_PL
Junior Member
Join Date: Aug 2010
Old 08-09-2010 , 14:48   Re: [ZP] Addon: Lighting At Start !! Updated v1.2 !!
Reply With Quote #9

Can you make a new version for Zombie Plague Advance 1.6 (assassin, sniper and armageddon mode) ?
Szwedzik_PL is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 08-10-2010 , 04:03   Re: [ZP] Addon: Lighting At Start !! Updated v1.2 !!
Reply With Quote #10

i don't get it
what does this do?
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 16:48.


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