Raised This Month: $51 Target: $400
 12% 

Lights On/Off


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:         
|2y@n
New Member
Join Date: Dec 2004
Old 12-05-2004 , 17:16   Lights On/Off
Reply With Quote #1

This is my first plugin, its makes the lights go on or off, type amx_lights 1 for off and amx_lights 0 for on. The main reason I made this plugin was for the fireworks mod, when this is on the fireworks look much cooler and makes them stand out 10 times more, enjoy this plugin and please reply with comments and/or suggestions

Updated The .sma, Please give suggestions or errors

Code:
#include <amxmodx> #include <amxmisc> #include <engine> public plugin_init() {     register_plugin("Lights Off/On","1.0","|2y@n");     register_clcmd("amx_lights","admin_lights",ADMIN_KICK," - 1 : ON | 0 : OFF");     } public admin_lights(id,level,cid) {     if (!cmd_access(id,level,cid,2))     {         return PLUGIN_HANDLED     }             new arg[32];     read_argv(1,arg,31);     if(arg[0] == '1')     {         set_hudmessage(200,100,100,-1.0,0.35,1,6.0,6.0,0.1,0.1,4);         show_hudmessage(0,"Nighty Night!");//Replace with your custom Message         set_lights("a");             }     else if(arg[0] == '0')     {         set_hudmessage(200,100,100,-1.0,0.35,1,6.0,6.0,0.1,0.1,4);         show_hudmessage(0,"Good Morning");//Replace with your custom message         set_lights("#OFF")         {                     }     }     else if(arg[0] != '1' || arg[0] != '0')     {         client_print(id,print_console,"amx_lights 1 = On | 0 = Off");     }     return PLUGIN_HANDLED }
Attached Files
File Type: sma Get Plugin or Get Source (lights.sma - 1612 views - 910 Bytes)
|2y@n is offline
Send a message via AIM to |2y@n
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-05-2004 , 17:47  
Reply With Quote #2

Good, but a few coding tips:

Code:
#include <cstrike>
No Cstrike-specific functions are used, but this will give an error for those trying to compile with mods other than Counter-Strike.

Code:
register_event("ResetHUD","NewRound","be");
What is this for? There is no NewRound function, so this will generate a native error on plugin load.

Code:
    if (!cmd_access(id,level,cid,1))     {         return PLUGIN_HANDLED     }
The fourth paramater for cmd_access() is the number of arguments for your command, plus one. Since yours takes one argument (0 or 1), this should be a 2 instead of a 1. The plugin will then automatically show correct usage in console if the user doesn't fill out the parameter.

The last thing: 0 usually represents off or no, and 1 usually represents on or yes; but in this plugin 0 turns the lights on and 1 turns them off--this will confuse some users.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
|2y@n
New Member
Join Date: Dec 2004
Old 12-05-2004 , 18:34   Updated
Reply With Quote #3

I Fixed the .sma please reply with comments and/or suggestions
|2y@n is offline
Send a message via AIM to |2y@n
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 12-06-2004 , 11:32  
Reply With Quote #4

could you edit your first post so it says 1 is on and 0 is off? that confused the heck out of me lol
oh and this plugin was great with missiles/hook on heh great fun searching for your enemy
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
|2y@n
New Member
Join Date: Dec 2004
Old 12-06-2004 , 17:11  
Reply With Quote #5

well the thing is, it is confusing, but when you think about it, the lights started as On, so making its amx_lights 1 means off, and then to turn off the off(if that makes any sense at all) you type amx_lights 0
__________________
|2y@n is offline
Send a message via AIM to |2y@n
xmdxtremekiller
Member
Join Date: Mar 2004
Old 12-06-2004 , 18:36  
Reply With Quote #6

lol you ripped the code off Freecode's NVG plugin, basically what you did was cut off the nvg part. anyways good job for trying. you should try to be more original AT LEAST GIVE CREDIT FOR WHAT YOU DO... btw i was making a plugin similar to this but its a kinda different. i think ill finish it by the weekend. I understand you're new but you gotta read the rules dude.
xmdxtremekiller is offline
|2y@n
New Member
Join Date: Dec 2004
Old 12-06-2004 , 20:13  
Reply With Quote #7

No I didn't I was trying to make it turn off after a new round but I didn't know the code completely
__________________
|2y@n is offline
Send a message via AIM to |2y@n
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-06-2004 , 20:25  
Reply With Quote #8

Quote:
Originally Posted by |2y@n
when you think about it, the lights started as On, so making its amx_lights 1 means off, and then to turn off the off(if that makes any sense at all) you type amx_lights 0
I understand what you mean, but naming the command lights and having 1 turn it off is kind of awkward. If you made the command nolights or lightsout or something that would make more sense as 1 being off.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
|2y@n
New Member
Join Date: Dec 2004
Old 12-06-2004 , 22:18  
Reply With Quote #9

I concurr, I will change it, the plugin will be named lightsout, thanx avalanche

amx_lightsout 1 to turn lights off, and amx_lightsout 0 to turn them back on, dont forget to try them with fireworks mod!
Attached Files
File Type: sma Get Plugin or Get Source (lightsout.sma - 1171 views - 920 Bytes)
__________________
|2y@n is offline
Send a message via AIM to |2y@n
MueckE
Senior Member
Join Date: Nov 2005
Old 11-17-2005 , 15:54  
Reply With Quote #10

I have a Question,

how is the cvar for the maps.cfg?
This Plugin should be aktiv automatic only on special maps. With an other Plugin it works. When i type in console "amx_lightsout 1" it changes.
But when i write it into de_dust.cfg it dont work. Can you help me please?

I only want this Plugin aktiv at special maps.
i dont want to have to type in, and dont want to have this plugin on every map.

greetz MueckE
MueckE 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 18:41.


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