AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   [ZP] Custom lights (https://forums.alliedmods.net/showthread.php?t=145214)

Welgericht 12-13-2010 09:10

[ZP] Custom lights
 
1 Attachment(s)
Custom Lights

Plugin: [ZP] Custom Lights
Version: 1.0 (beta)
Author: Doomday (aka Weltgericht)

Description:
This plugin allows you to use different lights for different mods.

Modules
PHP Code:

#include < amxmodx >

#include < zombieplague >
#include < engine > 

Cvars
PHP Code:

    cvars[infection]  =    register_cvar("zp_lights_infection""c");  
    
cvars[nemesis]    =    register_cvar("zp_lights_nemesis""a");  
    
cvars[survivor]   =    register_cvar("zp_lights_survivor""z");
    
cvars[swarm]      =    register_cvar("zp_lights_swarm""b");
    
cvars[multi]      =    register_cvar("zp_lights_multi""d");
    
cvars[plague]     =    register_cvar("zp_lights_plague""b");

// Lights at specified mod
// a - very dark 
// z - very bright 

Download:

Merry Christmas 12-13-2010 11:21

Re: [ZP] Custom lights
 
Awesome plugin!! Thanks!

abdul-rehman 12-13-2010 12:22

Re: [ZP] Custom lights
 
Its already been made:
http://forums.alliedmods.net/showthread.php?t=117143
And its much betterly coded than yours

mehmetali 12-13-2010 12:22

Re: [ZP] Custom lights
 
useful :up:

jc980 12-13-2010 22:23

Re: [ZP] Custom lights
 
this is better than yours abdul!

abdul-rehman 12-14-2010 02:38

Re: [ZP] Custom lights
 
This is his code
Code:
#include < amxmodx > #include < zombieplague > #include < engine > #define PLUGIN  "[ZP] Custom lights" #define VERSION "1.0" #define AUTHOR  "Doomsday" enum cvar {     infection,     nemesis,     survivor,     swarm,     multi,     plague } new cvars[cvar] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     cvars[infection]  = register_cvar("zp_lights_infection", "c");     cvars[nemesis]    = register_cvar("zp_lights_nemesis", "a");     cvars[survivor]   = register_cvar("zp_lights_survivor", "z");     cvars[swarm]      = register_cvar("zp_lights_swarm", "b");     cvars[multi]      = register_cvar("zp_lights_multi", "d");     cvars[plague]     = register_cvar("zp_lights_plague", "b"); } public zp_round_started (GameMode, id) {     if(GameMode == MODE_INFECTION)     {         set_lights("get_pcvar_string(cvars[infection])")     }     else if(GameMode == MODE_NEMESIS)     {         set_lights("get_pcvar_string(cvars[nemesis])")     }     else if(GameMode == MODE_SURVIVOR)     {         set_lights("get_pcvar_string(cvars[survivor])")     }     else if(GameMode == MODE_SWARM)     {         set_lights("get_pcvar_string(cvars[swarm])")     }     else if(GameMode == MODE_MULTI)     {         set_lights("get_pcvar_string(cvars[multi])")     }     else if(GameMode == MODE_PLAGUE)     {         set_lights("get_pcvar_string(cvars[multi])")     } }

And this is mine, which also haves more features:
Code:
#include <amxmodx> #include <zombieplague> // Used in indexing the cvar #define ROUND_START 0 // Global Variables new cvar_light[ MODE_PLAGUE + 1 ] new cvar_plugin_on, cvar_pointer_lighting public plugin_init( ) {     // Register the plugin and some natives     register_plugin( "[ZP] Lightings At Start", "1.1", "@bdul!" )     register_event( "HLTV", "event_round_start", "a", "1=0", "2=0" )         // Register some cvars     cvar_plugin_on =       register_cvar( "zp_lights_at_start" , "1" )     cvar_light[ ROUND_START ] =     register_cvar( "zp_starting_lights" , "f" )     cvar_light[ MODE_INFECTION ] =  register_cvar( "zp_infection_lighting" , "a" )     cvar_light[ MODE_NEMESIS ] =    register_cvar( "zp_nem_lighting" , "m" )     cvar_light[ MODE_SURVIVOR ] =   register_cvar( "zp_surv_lighting" , "b" )     cvar_light[ MODE_SWARM ] =  register_cvar( "zp_swarm_lighting" , "c" )     cvar_light[ MODE_MULTI ] =  register_cvar( "zp_multi_lighting" , "d" )     cvar_light[ MODE_PLAGUE ] =     register_cvar( "zp_plague_lighting" , "a" )     cvar_pointer_lighting = get_cvar_pointer( "zp_lighting" ) } // Set the lighting level on round start public event_round_start( ) {     // Make sure the plugin is on !     if ( get_pcvar_num( cvar_plugin_on ) )     {         // Retrieve the value at which the lighting will be set         static sz_starting_lights[ 2 ]         get_pcvar_string( cvar_light[ ROUND_START ], sz_starting_lights, charsmax( sz_starting_lights ) )                 // Set the lighting level         if ( sz_starting_lights[ 0 ] ) set_pcvar_string( cvar_pointer_lighting, sz_starting_lights )     } } // Set the lighting level after a mode starts public zp_round_started( mode, unused ) {     // Make sure its a valid mode     if ( !( MODE_INFECTION <= mode <= MODE_PLAGUE ) )         return;     // Make sure the plugin is on !     if ( get_pcvar_num( cvar_plugin_on ) )     {         // Retrieve the value at which the lighting will be set         static sz_mode_lights[ 2 ]         get_pcvar_string( cvar_light[ mode ], sz_mode_lights, charsmax( sz_mode_lights ) )                 // Set the lighting level         if ( sz_mode_lights[ 0 ] ) set_pcvar_string( cvar_pointer_lighting, sz_mode_lights )     } }
You can now see which is better and by the way his plugin wont even work cause of this
PHP Code:

set_lights("get_pcvar_string(cvars[swarm])"

He is setting the cvar inside the string which wont work :nono:

jc980 12-14-2010 02:58

Re: [ZP] Custom lights
 
tested it?

Welgericht 12-14-2010 08:53

Re: [ZP] Custom lights
 
Haw can it be done by another way?

abdul-rehman 12-14-2010 09:02

Re: [ZP] Custom lights
 
look into my plugin


All times are GMT -4. The time now is 11:00.

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