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

Cops n Robbers


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
KiWigamez0r
Junior Member
Join Date: Aug 2009
Old 06-16-2010 , 11:40   Cops n Robbers
Reply With Quote #1

Hi all! This is the first full plugin that I have made and a lot of the coding is bound to be redundant or buggy, so any suggestions or criticism is greatly appreciated.

DESCRIPTION

In short, Cops n Robbers is a game of stealth, reflexes, strategy and teamwork.

While this plugin is not thorough enough to be a full gameplay modification, it can be used as a minigame
or an occasional event in order to spice up your server.

The overall objective for either team is to kill all of the opposing team's players.
For CTs, this can be done simply by shooting the terrorists.
For Ts however, it is more difficult, as they only spawn with a knife.
Additionally, the CTs start with 500 hitpoints, where the Ts start with the standard 100.
The catch is that the Ts are invisible and cannot be seen by the CTs.
The Ts are able to obtain weapons and powerups through the shop included in this plugin (say /shop).
However, the only way for Ts to gain money is to commit crimes.
While committing a crime, the T becomes visible and the CTs are notified.
So the CTs patrol the map hunting for deviant Ts, trying to catch them in the act, while at all times checking
their back for sneaky pickpocketers (one of the criminal professions).
The Ts attempt to stealthfully avoid the CTs so that they can commit their crimes and build up their money
for an eventual assault on the CTs.
As an optional twist, an admin can change the cvar "cnr_fbimode" to 1 to change the game mode to "FBI".
This means that every round the CTs can select a random object to transform into in order to stake-out
the Ts and catch them in the act.
This can be used strategically, as the CTs each cover a different post looking like inconspicuous objects,
making it very difficult for the Ts to go about unnoticed.
It should be noted that while the game is in this mode, it may be more difficult for Ts under the professions
Pickpocketer and rapist as they have to stalk the CTs in order to commit their crimes.
It should also be noted that Ts are only invisible when weilding the knife and become visible when they attack a CT
with any weapon for a certain period of time (default 5 seconds).
The CTs also get a shop which is accessable by typing /ctshop (as opposed to simply /shop). This shop sells items
that assist in the apprehension and discovery of the sneaky criminals.
The CTs gain a certain amount of money (salary, 500 by default) every round, but also receive bonuses depending on
the damage they do to enemies.

Classes

Every round, a menu pops up for the terrorists, allowing them to choose a criminal profession.
As at version 1.0 (current), there are 3 professions to choose from:

1) Marijuana Grower - The criminal must find a hiding spot somewhere on the map and press E to begin planting marijuana. For a certain period of time (20 seconds by default) they are drastically slowed and visible. If they survive the full length of this time, they are given a large sum of money.

2) Pick-Pocketer - The criminal must stalk a CT and knife them in order to steal a small amount of money from that CT.

3) Rapist - The criminal must press E to activate the "rapist knife" and then stalk a CT, knifing them to rape them. While being raped, the CT cannot move or attack the rapist, but has godmode. The T is also immobilized, and can be attacked by any CT other than the one being raped. This process lasts a certain period of time (20 seconds by default) and after this time, the T gains a moderate sum of money and is visible for a certain period of time after the raping (5 seconds by default) so the CT can attempt to get his Revenge.

Shop Items
TERRORIST SHOP (say /shop)
GUNS
M4A1
Pump shotgun (M3)
Deagle
Awp
Para
OTHER
+100 hp
+100 ap
speed
silence (no footsteps)

COUNTER_TERRORIST SHOP (say /ctshop)
detector
Makes all Ts visible for a set amount of time (default 15 seconds)
SNIFFER CRAB
Spawns a headcrab that wanders around until it finds a T and then chases them. This is used to sniff out the general location of an invisible criminal as well as alert you when they are near. You can press E to teleport the headcrab to you so you can bring it with you.
RADAR
Pings all terrorists nearby on your radar every 2 seconds, giving the general location of a hiding or stalking criminal.


CVARS

---Gameplay---
cnr_fbimode", Determines whether or not FBI mode is enabled (Default = 0 [off])
cnr_startmoney", Sets the starting value of money for all players (Default = 500)
cnr_criminal_slash_only", Determines whether or not Ts are only able to "nubslash" (Default = 1 [on])
cnr_armed_criminal_time", Sets the time after an assault in which a T is visible (Default = 10.0)
cnr_pickpocket_amount", Sets the amount of money a successful pick-pocketer receives (Default = 50)
cnr_pickpocket_criminal_time", Sets the amount of time a successful pick-pocketer remains visible (Default = 5.0)
cnr_marijuana_time", Sets the amount of time it takes to finish planting marijuana (Default = 20.0)
cnr_marijuana_amount", Sets the monetary reward for planting marijuana (Default = 500)
cnr_rape_time", Sets the length of time it takes to "rape" a person (Default = 20.0)
cnr_rape_amount", Sets the monetary reward for "raping" a person (Default = 350)
cnr_rape_delay, Sets the length of time following the rape before the rapist is able to activate their "rapist knife" again (Default = 5.0)
cnr_rape_criminal_time, Sets the length of time following the rape before the rapist becomes invisible (Default = 5.0)
cnr_assault_criminal_time, Sets the length of time following a regular assault (attack on any CT using any weapon) before the T regains invisibility (Default = 5.0)
cnr_ct_salary, Sets the amount of money a CT gains each round (Default = 500)
cnr_ct_damage_multiplier, Sets the number that is multiplied to the damage done on an enemy, resulting in a cash bonus (Default = 2.0)
For example, if cnr_ct_damage_multiplier is set to 2, if a CT shoots a T, doing 50 damage, he receives (2*50 = 100) money as a bonus
cnr_marijuana_sound, Determines whether or not to play a sound every 2 seconds when a player is planting marijuana (Default = 1[on])

---Shops---
cnr_m4a1cost, Sets the cost of the M4A1 in the terrorist shop (Default = 3500)
cnr_pumpcost, Sets the cost of the pump shotgun in the terrorist shop (Default = 3000)
cnr_deaglecost, Sets the cost of the deagle in the terrorist shop (Default = 2500)
cnr_awpcost, Sets the cost of the awp in the terrorist shop (Default = 5000)
cnr_paracost, Sets the cost of the para in the terrorist shop (Default = 5000)
cnr_hpcost, Sets the cost of +100 hp in the terrorist shop (Default = 1500)
cnr_apcost, Sets the cost of +100 ap in the terrorist shop (Default = 1000)
cnr_speedcost, Sets the cost of additional speed in the terrorist shop (Default = 2000)
cnr_speed_amount, Sets the level of additional speed from the terrorist shop (Default = 300.0)
cnr_silencecost, Sets the cost of silent footsteps in the terrorist shop (Default = 3500)
cnr_detectorcost, Sets the cost of detector from the counter-terrorist shop (Default = 3000)
cnr_detectortime, Sets the time that the detector lasts (Default = 15.0)
cnr_crabcost, Sets the cost of the sniffer crab in the counter-terrorist shop (Default = 1500)
cnr_radarcost, Sets the cost of the radar in the counter-terrorist shop (Default = 2500)
cnr_radarsound, Determines whether or not to play a sound after each 2 second ping of the radar (Default = 1 [on])

CREDITS

General Credits

GHW_Chronic for his headcrab AI plugin, and chr_engine and headcrab includes
I used these in adding the sniffer crab to this plugin

apuu for his hns transformers plugin
I used the models from that plugin for the FBI mode of this plugin

SonicSonedit for his ZP extra item - radar plugin
I took the radar from that plugin and added it to the CT shop for this

Inspiration and Ideas

Necro for his blockmaker plugin
I learned a lot of my coding knowledge from this plugin and so this plugin is heavily influenced by it

Al3x for his optimisation of necro's blockmaker plugin
I also learned a few techniques from this

Exolent for his hide'n'seek plugin
I also learned a lot of my coding knowledge from this plugin and so this plugin is heavily influenced by it as well


MODULES REQUIRED
Fakemeta
Fun
Cstrike
Engine
Hamsandwich

CHANGELOG
V1.0 - Created, minimal testing.
V1.1 - Added marijuana sound cvar, incorporated stocks from additional includes into code, slight code improvement. Minimal testing.


NOTES
This plugin requires GHW_Chronic's headcrab AI plugin in order for it to work.

This plugin uses stocks from the following includes: colorchat.inc, headcrab.inc, chr_engine.inc. The functions from those includes are not mine and credits for their creators are mentioned above.
Attached Files
File Type: sma Get Plugin or Get Source (cnr.sma - 876 views - 55.8 KB)
File Type: zip cstrike.zip (72.7 KB, 251 views)

Last edited by KiWigamez0r; 06-19-2010 at 21:43. Reason: V1.1
KiWigamez0r is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-16-2010 , 12:03   Re: Cops n Robbers
Reply With Quote #2

You should just rip the needed functions/constants from the includes and put them in your plugin so people won't have to recompile it just to put it on their server.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 06-17-2010 at 23:36. Reason: typo
wrecked_ is offline
Old 06-16-2010, 12:58
wundeR
This message has been deleted by wundeR. Reason: My wrong!
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-16-2010 , 14:42   Re: Cops n Robbers
Reply With Quote #3

Code is not so bad (from a fast first sight). But I can see alot of things that could have been done better or smaller, like :

PHP Code:
if ( money >= m4a1cost )
    {
        
cb1 "\w";
    }
    else if ( 
money m4a1cost )
    {
        
cb1 "\d";
    }
    if ( 
money >= pumpcost )
    {
        
cb2 "\w";
    }
    else if ( 
money pumpcost )
    {
        
cb2 "\d";
    }
    if ( 
money >= deaglecost )
    {
        
cb3 "\w";
    }
    else if ( 
money deaglecost )
    {
        
cb3 "\d";
    }
    if ( 
money >= awpcost )
    {
        
cb4 "\w";
    }
    else if ( 
money awpcost )
    {
        
cb4 "\d";
    }
    if ( 
money >= paracost )
    {
        
cb5 "\w";
    }
    else if ( 
money paracost )
    {
        
cb5 "\d";
    } 
Can be done with just a simple loop

But when looking closer. Why are u using fm_util for give_item?
U have fun included but still ur using those crappy util stocks of fakemeta. Why is that?
__________________
I am out of order!

Last edited by grimvh2; 06-16-2010 at 14:44.
grimvh2 is offline
KiWigamez0r
Junior Member
Join Date: Aug 2009
Old 06-16-2010 , 20:31   Re: Cops n Robbers
Reply With Quote #4

Quote:
Originally Posted by wrecked_ View Post
You should just rip the needed functions/constants from the includes and but them in your plugin so people won't have to recompile it just to put it on their server.
Great idea, I'll get right on that .

Quote:
Originally Posted by grimvh2
Can be done with just a simple loop
Would you mind showing me how? I'm not quite sure .

Quote:
Originally Posted by grimvh2
U have fun included but still ur using those crappy util stocks of fakemeta
Woops, I'll fix that too .
KiWigamez0r is offline
ToriQQ
Member
Join Date: Mar 2010
Old 06-17-2010 , 07:38   Re: Cops n Robbers
Reply With Quote #5

Great plugin !
Should be approved.
__________________

ToriQQ is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-17-2010 , 07:41   Re: Cops n Robbers
Reply With Quote #6

@grim:
cb1 = ( money >= m4a1cost ) ? "\w" : "\d";
__________________
xPaw is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-17-2010 , 09:12   Re: Cops n Robbers
Reply With Quote #7

Quote:
Originally Posted by xPaw View Post
@grim:
cb1 = ( money >= m4a1cost ) ? "\w" : "\d";
He can make it like cb[5][4] and loop trough them... Would look much cleaner.
__________________
I am out of order!
grimvh2 is offline
KiWigamez0r
Junior Member
Join Date: Aug 2009
Old 06-17-2010 , 20:58   Re: Cops n Robbers
Reply With Quote #8

Quote:
Originally Posted by ToriQQ View Post
Great plugin !
Should be approved.
Thanks ^^ if you play it and find any bugs, let me know and I'll do my best to fix them .


Quote:
Originally Posted by xPaw
cb1 = ( money >= m4a1cost ) ? "\w" : "\d";
I think I get how this works, I'll incorporate this in now. Thanks .


Quote:
Originally Posted by grimvh2
He can make it like cb[5][4] and loop trough them... Would look much cleaner.
Could I trouble you to give me an example? I am still not sure how to do this :p.
KiWigamez0r is offline
ToriQQ
Member
Join Date: Mar 2010
Old 06-17-2010 , 23:28   Re: Cops n Robbers
Reply With Quote #9

Hi there , why do i crash my server when running this plugin when i am creating? lols
__________________

ToriQQ is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-17-2010 , 23:34   Re: Cops n Robbers
Reply With Quote #10

Quote:
Originally Posted by wrecked_ View Post
You should just rip the needed functions/constants from the includes and put them in your plugin so people won't have to recompile it just to put it on their server.
__________________
Hi.
Kreation 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 17:13.


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