Raised This Month: $ Target: $400
 0% 

Limit Knife Time /w cooldown.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EvolDay
Senior Member
Join Date: Apr 2008
Location: Canada
Old 07-17-2008 , 23:32   Limit Knife Time /w cooldown.
Reply With Quote #1

Could someone make me a plugin, where you can only have your knife out for 10 seconds. then have a cooldown time of 15 seconds before you can take out your knife again. Also it should only effect CT's not Terrorist.

I need it because i have biohazard mod + credits mod. and i dont want ppl to just camp with there knife being totally invisable. So the plugin must be able to detect when a player is transfered to the other team. and not affect the zombie because they can only have there zombie claws out which i think is a knife.

Thank you to anyone who can help me.
EvolDay is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 07-18-2008 , 10:10   Re: Limit Knife Time /w cooldown.
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN    "New Plugin" #define VERSION    "1.0" #define AUTHOR    "Author" #define TASK_CHECKWEAPON 1122 new bool:usingknife[33]; new bool:cooldown[33]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_event("CurWeapon","event_curweapon","be","1=1"); } public event_curweapon(id) {     if(get_user_team(id) != 2)         return PLUGIN_CONTINUE;             new clip, ammo, weapon = get_user_weapon(id, clip, ammo);         if(weapon == CSW_KNIFE)     {         if(cooldown[id])         {             client_cmd(id, "slot1")         }                 else         {             set_task(15.0, "checkweapon", TASK_CHECKWEAPON + id)             usingknife[id] = true;         }     }         else if(weapon != CSW_KNIFE)     {         new taskid = id + TASK_CHECKWEAPON                 if(task_exists(taskid))         {             remove_task(taskid)         }                 usingknife[id] = false;     }         return PLUGIN_CONTINUE; } public checkweapon(taskid) {     new id = taskid - TASK_CHECKWEAPON     new clip, ammo, weapon = get_user_weapon(id, clip, ammo);         if(weapon == CSW_KNIFE)     {         client_cmd(id, "slot1")     }         usingknife[id] = false;     cooldown[id] = true;         set_task(15.0, "cooldown_over", id) } public cooldown_over(id) {     cooldown[id] = false; }

Untested.

Last edited by Jon; 07-18-2008 at 10:15.
Jon is offline
EvolDay
Senior Member
Join Date: Apr 2008
Location: Canada
Old 07-18-2008 , 15:02   Re: Limit Knife Time /w cooldown.
Reply With Quote #3

I will test this out and let you know if it works Thank you.

Edit:
Well i was testing it out it does sort of work. It doesnt detect when a CT gets turned in a zombie so you can hear it trying to force weapon change to primary.

It is easily bypassed by quickly switching to your primary for a spilt second then back to knife.

also it doesnt affect players that were spawned as a terrorist and got transfered to the other team after zombie is chooses.

Last edited by EvolDay; 07-18-2008 at 15:38.
EvolDay 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 19:33.


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