Raised This Month: $267 Target: $400
 66% 

Ready /snipers menu


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-17-2014 , 08:35   Ready /snipers menu
Reply With Quote #1

Intro:
I've listened to many suggestions and requests about a plugin, which to have a menu only with snipers to buy. I didn't find similar one, but if there already is, please excuse me. I think this plugin may be usefull for CSDM or Surf servers, where the owners doesn't want to have free snipers and campers with them everywhere.

Description:
- The menu includes the 4 snipers: AWP, G3SG1, SG552, Scout.
- Each of them can be turned on/off from the menu with cvars. If the sniper is turned off, it gets unclickable and it's name in the menu changes, also the color.
- Snipers' prices can also be changed via cvars.
- I've also added a bonus deagle option, for the fun servers - whoever likes this add, it could be also turned on/off with cvars.
*That bonus deagle option can refer to givin deagle with every sniper and giving deagle by chance with percent, which is also constrolable vie cvar.
- Also included a chat messages prefix, which you can change with cvar.


CVARs:

1. Turning on/off the snipers:
sniper_awp_on
/Turns on/off the AWP/
sniper_g3sg1_on
/Turns on/off the G3SG1/
sniper_sg552_on
/Turns on/off the SG552/
sniper_scout_on
/Turns on/off the Scout/
*All the snipers are turned on by default.
*1 - sniper will appear in the menu.
*0 - sniper won't be in the menu.

2. The prices of the different snipers:
sniper_awp_cost (default: 10000)
/The price of the AWP/
sniper_g3sg1_cost (default: 12000)
/The price of the G3SG1/
sniper_sg552_cost (default: 12000)
/The price of the SG552/
sniper_scout_cost (default: 7000)
/The price of the Scout/

3. And here is the Bonus Deagle cvar:
sniper_deagle_bonus (default: 0)
/If 0, won't give bonus deagle/
/If 1, it will give a bonus deagle with every sniper/
/If 2, it will give a chance to give sniper, which percent of chance you can control with cvar/

sniper_deagle_chance_percent (default: 25)
/This cvar is important only if the cvar above is set to 2/
/That's the percent of chance to give a deagle bonus with the sniper/
/In every different opening of menu, the chance will be checked again/

4. The chat prefix (it will be green):
sniper_message_prefix (default: [Prefix])

And here is another cvar, which defines the main function - the type of giving the sniper, and deagle if defined by cvars.
5. Giving the sniper type:
sniper_give_type (default: 1)
/0 - Only adds the sniper to the other weapon of the player. And now he will have two guns - the previous weapon and the sniper/
/1 - Will strip user primary weapons and give him only a sniper/

Changelog:
Code:
-------------Version 1.1--------------
- Rewrote the whoole code to a brand new level
- Added the bonus deagle chance option
- Renew the cvar getting type
- Renew the main style of menu
- Renew the checks for turning om/off the snipers
Credits:
- @Blizzard_87 - the whole idea and the helpful example of working with enums. Great idea for this method, thanks a lot!


You should compile the plugin localy, because of the includes needed. They are attached in the thread.
Attached Files
File Type: inc stripweapons.inc (4.5 KB, 370 views)
File Type: inc colorchat.inc (5.9 KB, 315 views)
File Type: sma Get Plugin or Get Source (Snipers.sma - 445 views - 4.2 KB)
__________________

Last edited by Flick3rR; 02-11-2015 at 13:28.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Blizzard_87
AlliedModders Donor
Join Date: Oct 2012
Old 05-18-2014 , 08:09   Re: Ready /snipers menu
Reply With Quote #2

you havent mentioned about having to compile locally due to the include files.

and you should also attach the includes so people don't have to go looking for them...

your code is messy you could clean it up alot to make it more easily readable.

and you shouldnt use get_pcvar_num in your menu function as checking those cvars each time a player opens menu is very inefficient. should cache those cvars in round start then just check those global variables in the menu function.

Code:
public SniperHandler(id, menu, item) {     get_pcvar_string(CvarPrefix, Prefix, 31)
i dont see why you check the prefix string in a function you dont even use it.?
__________________

Last edited by Blizzard_87; 05-18-2014 at 08:15.
Blizzard_87 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-18-2014 , 08:49   Re: Ready /snipers menu
Reply With Quote #3

Now, I've made the code little like this, because I wanted it to look compact and not that spreaded. But if it'll be better and more easy readable, I may expand it to look good.
About the string, I've got it in this function, because of the public messages in the lower part of the plugin. Here I get the string, and I use it in the messages below.
About the includes - I'll attach te stripweapons of course, forgot it!
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Blizzard_87
AlliedModders Donor
Join Date: Oct 2012
Old 05-18-2014 , 17:47   Re: Ready /snipers menu
Reply With Quote #4

Quote:
Originally Posted by Flick3rR View Post
Now, I've made the code little like this, because I wanted it to look compact and not that spreaded. But if it'll be better and more easy readable, I may expand it to look good.
About the string, I've got it in this function, because of the public messages in the lower part of the plugin. Here I get the string, and I use it in the messages below.
About the includes - I'll attach te stripweapons of course, forgot it!
You could also cache the prefix into a global variable in the new round event also.

This way if admins change cvars then they get checked every new round to keep them up to date. And your not checking them every time someone opens menu.
__________________
Blizzard_87 is offline
ArabicMan
Veteran Member
Join Date: Feb 2014
Location: مصر
Old 06-02-2014 , 21:09   Re: Ready /snipers menu
Reply With Quote #5

Not bad i'll test it.
ArabicMan is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-03-2014 , 10:16   Re: Ready /snipers menu
Reply With Quote #6

Any problems, suggestions, notes? I'm going to renew and update the code by Blizzard's example. Hope he didn't get me wrong, because I didn't do this earlier.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
ezio_auditore
Senior Member
Join Date: May 2013
Old 06-03-2014 , 10:31   Re: Ready /snipers menu
Reply With Quote #7

Suggestion..
amx_deagle_bonus.

Try not giving deagle every time, there must be random chances of reciving deagle
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-03-2014 , 10:59   Re: Ready /snipers menu
Reply With Quote #8

Good. Will make two options for the cvar. Every time and with a chance.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-03-2014 , 18:23   Re: Ready /snipers menu
Reply With Quote #9

A big update is done! Added new features and also rewrote the wohle code, made it more efficient and easy readable. Waiting for your notes! BIG THANKS TO BLIZZARD_87!
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
EthicalHacker007
Veteran Member
Join Date: May 2014
Old 06-04-2014 , 05:44   Re: Ready /snipers menu
Reply With Quote #10

Quote:
Originally Posted by Flick3rR View Post
A big update is done! Added new features and also rewrote the wohle code, made it more efficient and easy readable. Waiting for your notes! BIG THANKS TO BLIZZARD_87!
Should I test it?

Edit: Tested plugin with every cvar value. Everything's fine. But as you've created this for csdm/surf servers, I suggest you to either set bpammo to 200 or unlimited bpammo.
__________________

Last edited by EthicalHacker007; 06-04-2014 at 07:07.
EthicalHacker007 is offline
Reply


Thread Tools
Display Modes

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 12:49.


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