Raised This Month: $32 Target: $400
 8% 

[REQ]Very Simple Knife Match Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alibalali
Member
Join Date: Aug 2014
Old 08-26-2014 , 17:40   [REQ]Very Simple Knife Match Plugin
Reply With Quote #1

Hi
I searched for a simple knife plugin but I could not find It
I want a simple knife match plugin that that have only one cvar something like
amx_knifemod <0/1> (1 :enable knife match , 0 : disable knife match (normal gaming) , Default 0)
that admin with f flag can control this & the plugin also support bots
when knife mod will be enabled All players will receive a massage that contains "Admin %Admin Name% Activated Knife Match" and players cant use any weapon excluding knife , c4 and defuder (in de_ maps)
and when the knife mod will be disabled All players receive a massage that contains "Admin %Admin Name% Deactivated Knife Match" & players can use any weapon
and when the knife mod enabled or disabled the scores should not be reseted
**sorry for bad English**
alibalali is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 08-26-2014 , 18:10   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #2

Here it is. Command:
amx_knifemod 1/0 <1 - enable | 0 - disable knife mod>

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLAYER_CBASE    41
#define XO_WEAPON        4

const ACCESS ADMIN_MAP

new bool:g_bKnifeModEnabled false

public plugin_init()
{
    
register_plugin("Knife Mod""1.0""Flicker")
    
    
register_concmd("amx_knifemod""onKnifeModCmd"ACCESS"1 - enable | 0 - disable")
    
    new 
szWeaponName[20]
    for(new 
CSW_P228<= CSW_P90i++) 
    { 
        if(
== CSW_KNIFE || == CSW_C4
            continue
        
        if(
get_weaponname(iszWeaponNamecharsmax(szWeaponName)))
            
RegisterHam(Ham_Item_DeployszWeaponName"onItemDeployPost"true)
    }
}

public 
onKnifeModCmd(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
    
new szValue[10]
    
read_argv(1szValuecharsmax(szValue))
    
    if(!
is_str_num(szValue))
    {
        
console_print(id"You must choose 1 or 0 to enable/disable knife mod!")
        return 
PLUGIN_HANDLED
    
}
    
    new 
value str_to_num(szValue)
    
    
g_bKnifeModEnabled value true false
    console_print
(id"You successdully %s knife mod!"g_bKnifeModEnabled "enabled" "disabled")
    
    return 
PLUGIN_HANDLED
}

public 
onItemDeployPost(ent)
{
    if(
g_bKnifeModEnabled)
    {
        new 
id get_pdata_cbase(entPLAYER_CBASEXO_WEAPON)
        
client_cmd(id"weapon_knife")
    }

__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
alibalali
Member
Join Date: Aug 2014
Old 08-27-2014 , 05:24   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #3

Quote:
Originally Posted by Flick3rR View Post
Here it is. Command:
amx_knifemod 1/0 <1 - enable | 0 - disable knife mod>

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLAYER_CBASE    41
#define XO_WEAPON        4

const ACCESS ADMIN_MAP

new bool:g_bKnifeModEnabled false

public plugin_init()
{
    
register_plugin("Knife Mod""1.0""Flicker")
    
    
register_concmd("amx_knifemod""onKnifeModCmd"ACCESS"1 - enable | 0 - disable")
    
    new 
szWeaponName[20]
    for(new 
CSW_P228<= CSW_P90i++) 
    { 
        if(
== CSW_KNIFE || == CSW_C4
            continue
        
        if(
get_weaponname(iszWeaponNamecharsmax(szWeaponName)))
            
RegisterHam(Ham_Item_DeployszWeaponName"onItemDeployPost"true)
    }
}

public 
onKnifeModCmd(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
    
new szValue[10]
    
read_argv(1szValuecharsmax(szValue))
    
    if(!
is_str_num(szValue))
    {
        
console_print(id"You must choose 1 or 0 to enable/disable knife mod!")
        return 
PLUGIN_HANDLED
    
}
    
    new 
value str_to_num(szValue)
    
    
g_bKnifeModEnabled value true false
    console_print
(id"You successdully %s knife mod!"g_bKnifeModEnabled "enabled" "disabled")
    
    return 
PLUGIN_HANDLED
}

public 
onItemDeployPost(ent)
{
    if(
g_bKnifeModEnabled)
    {
        new 
id get_pdata_cbase(entPLAYER_CBASEXO_WEAPON)
        
client_cmd(id"weapon_knife")
    }

It have 3 small problems:

first >when the plugin will be activated player can use his weapon until the player use knife or the game will be restarted; player should forced to change his weapon to knife or maybe disarm cod is required

2nd> no massage have been shown to all players (in chat place or another place) that the knife mod has been activated or deactivated (massage should contain %admin name% who activated the knife mod)

3rd> this plugin does not support bots maybe bot_knives_only 1 then disarm bots is required

Last edited by alibalali; 08-27-2014 at 06:37.
alibalali is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 08-27-2014 , 07:07   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #4

Let me see. When admin types amx_knifemod 1, the mode is enabled and everybody is forced to use knife only, right? I didn't hook any round restarts or sth like this, maybe I can't understand clearly what you want?
The message is fixed.
I don't see why it should not work with bots, will try with CurWeapon event instead.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

const ACCESS ADMIN_MAP

new bool:g_bKnifeModEnabled false

public plugin_init()
{
    
register_plugin("Knife Mod""1.0""Flicker")
    
    
register_concmd("amx_knifemod""onKnifeModCmd"ACCESS"1 - enable | 0 - disable")
    
    
register_event("CurWeapon""onCurWeaponEvent""be""1=1")
}

public 
onKnifeModCmd(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
    
new szValue[10]
    
read_argv(1szValuecharsmax(szValue))
    
    if(!
is_str_num(szValue))
    {
        
console_print(id"You must choose 1 or 0 to enable/disable knife mod!")
        return 
PLUGIN_HANDLED
    
}
    
    new 
value str_to_num(szValue)
    
    
g_bKnifeModEnabled value true false
    console_print
(id"You successdully %s knife mod!"g_bKnifeModEnabled "enabled" "disabled")
    
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
    
client_print(0print_chat"Admin %s %s knife mod!"szNameg_bKnifeModEnabled "enabled" "disabled")
    
    return 
PLUGIN_HANDLED
}

public 
onCurWeaponEvent(id)
    if(
g_bKnifeModEnabled)
        
client_cmd(id"weapon_knife"
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-27-2014 , 07:31   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #5

You can use engclient_cmd, it's faster than client_cmd. When you are using client_cmd, it sends a message to the client, then the client send one again to server( AFAIK ).
__________________
HamletEagle is offline
alibalali
Member
Join Date: Aug 2014
Old 08-27-2014 , 07:41   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #6

Quote:
Originally Posted by Flick3rR View Post
Let me see. When admin types amx_knifemod 1, the mode is enabled and everybody is forced to use knife only, right? I didn't hook any round restarts or sth like this, maybe I can't understand clearly what you want?
The message is fixed.
I don't see why it should not work with bots, will try with CurWeapon event instead.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

const ACCESS ADMIN_MAP

new bool:g_bKnifeModEnabled false

public plugin_init()
{
    
register_plugin("Knife Mod""1.0""Flicker")
    
    
register_concmd("amx_knifemod""onKnifeModCmd"ACCESS"1 - enable | 0 - disable")
    
    
register_event("CurWeapon""onCurWeaponEvent""be""1=1")
}

public 
onKnifeModCmd(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
    
new szValue[10]
    
read_argv(1szValuecharsmax(szValue))
    
    if(!
is_str_num(szValue))
    {
        
console_print(id"You must choose 1 or 0 to enable/disable knife mod!")
        return 
PLUGIN_HANDLED
    
}
    
    new 
value str_to_num(szValue)
    
    
g_bKnifeModEnabled value true false
    console_print
(id"You successdully %s knife mod!"g_bKnifeModEnabled "enabled" "disabled")
    
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
    
client_print(0print_chat"Admin %s %s knife mod!"szNameg_bKnifeModEnabled "enabled" "disabled")
    
    return 
PLUGIN_HANDLED
}

public 
onCurWeaponEvent(id)
    if(
g_bKnifeModEnabled)
        
client_cmd(id"weapon_knife"
Thank you
My First & 2nd problem have bin solved completely. But the bots did not forced to use knife only. after round restart manually nothing did not changed and bots still can use any weapon; when I used cvar bot_knives_only 1 manually they still use their guns until the round restart or using amx_disarm cvar
can you find a solution for it?

Last edited by alibalali; 08-27-2014 at 07:43.
alibalali is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-27-2014 , 07:56   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #7

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <hamsandwich> const ACCESS = ADMIN_MAP new bool:g_bKnifeModEnabled = false public plugin_init() {     register_plugin("Knife Mod", "1.0", "Flicker")         register_concmd("amx_knifemod", "onKnifeModCmd", ACCESS, "1 - enable | 0 - disable")         register_event("CurWeapon", "onCurWeaponEvent", "be", "1=1") } public onKnifeModCmd(id, level, cid) {     if(!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED             new szValue[10]     read_argv(1, szValue, charsmax(szValue))         if(!is_str_num(szValue))     {         console_print(id, "You must choose 1 or 0 to enable/disable knife mod!")         return PLUGIN_HANDLED     }         new value = str_to_num(szValue)         g_bKnifeModEnabled = value ? true : false     console_print(id, "You successdully %s knife mod!", g_bKnifeModEnabled ? "enabled" : "disabled")         new szName[32]     get_user_name(id, szName, charsmax(szName))         client_print(0, print_chat, "Admin %s %s knife mod!", szName, g_bKnifeModEnabled ? "enabled" : "disabled")         return PLUGIN_HANDLED } public onCurWeaponEvent(id)     if(g_bKnifeModEnabled)       engclient_cmd(id, "weapon_knife")

Try this.
__________________
HamletEagle is offline
alibalali
Member
Join Date: Aug 2014
Old 08-27-2014 , 08:13   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <hamsandwich> const ACCESS = ADMIN_MAP new bool:g_bKnifeModEnabled = false public plugin_init() { register_plugin("Knife Mod", "1.0", "Flicker") register_concmd("amx_knifemod", "onKnifeModCmd", ACCESS, "1 - enable | 0 - disable") register_event("CurWeapon", "onCurWeaponEvent", "be", "1=1") } public onKnifeModCmd(id, level, cid) { if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED new szValue[10] read_argv(1, szValue, charsmax(szValue)) if(!is_str_num(szValue)) { console_print(id, "You must choose 1 or 0 to enable/disable knife mod!") return PLUGIN_HANDLED } new value = str_to_num(szValue) g_bKnifeModEnabled = value ? true : false console_print(id, "You successdully %s knife mod!", g_bKnifeModEnabled ? "enabled" : "disabled") new szName[32] get_user_name(id, szName, charsmax(szName)) client_print(0, print_chat, "Admin %s %s knife mod!", szName, g_bKnifeModEnabled ? "enabled" : "disabled") return PLUGIN_HANDLED } public onCurWeaponEvent(id) if(g_bKnifeModEnabled) engclient_cmd(id, "weapon_knife")


Try this.
the plugins still not working with bots
how I can change color of client massage?
alibalali is offline
alibalali
Member
Join Date: Aug 2014
Old 08-27-2014 , 09:44   Re: [REQ]Very Simple Knife Match Plugin
Reply With Quote #9

If there is no solution for bots
please help me by changing the color of client massage
green:[Admin] + white:%s <admin Name> + red:%s <Enabled or Disabled> + green:knife + green:mod!

Last edited by alibalali; 08-27-2014 at 12:30.
alibalali 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 11:20.


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