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

Knife Round v2.0


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-14-2009 , 03:44   Knife Round v2.0
Reply With Quote #1

Knife Round v2.0
by Juice

.: Description :.

1. When admin types /kf, /kr, or /kniferound, knife round begins
2. When knife round begins, your weapons will be auto switched to knife
3. After knife round end, in new round the winning team can choose: swap teams or not

4. You can choose no slash by cvar

.: Admin Commands :.

say /kf, /kr, /kniferound - start knife round
say /swap - swap teams
say /rr - restart round

.: Cvars :.

kr_swapvote - enable/disable "Swap Teams?" vote after knife round
kr_noslash - enable/disable noslash in knife round


.: Credits :.
tolsty - helped me with vote: http://forums.alliedmods.net/showthread.php?t=103498
Jon - swap teams code from his HnS plugin http://forums.alliedmods.net/showthread.php?t=73244

.: Changelog :.
1.0 - Knife code from "Simple ClanWar Management"
1.1 - Removed hud messages, added cur_weapon event instead of strip_weapons task
1.2 - Added vote, bug fixes, first release
1.3 - Small fixes, another Swap Teams method
1.4 - Added multillingual
1.5 - Using hamsandwich instead of fakemeta to remove slash
1.6 - Block shield buying, added translations
1.7 - Bug fixes
1.8 - Removed c4 ignore, small code optimization
1.9 - Fixed mistakes in code
2.0 - Main update - another menu style, added: message tag, vote messages, changed cvar name "kr_teamvote" to "kr_swapvote"

.: Translations :.

Need translations!!!
[en] - Juice
[ru] - Juice
[pl] -
ZoMMcio
[nl] - grimvh2


Attached Files
File Type: inc colorchat.inc (2.5 KB, 1771 views)
File Type: sma Get Plugin or Get Source (kniferound_adv.sma - 4731 views - 7.4 KB)
File Type: txt kniferound.txt (1.6 KB, 2336 views)

Last edited by lazarev; 07-27-2011 at 08:32.
lazarev is offline
DarkSkif
Member
Join Date: Oct 2009
Location: Russia
Old 10-14-2009 , 04:03   Re: Knife Round by Juice & tolsty
Reply With Quote #2

Nice!
DarkSkif is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-14-2009 , 13:05   Re: Knife Round by Juice & tolsty
Reply With Quote #3

PHP Code:
for(new 033i++) 
No. Store get_maxplayers in a global variable and use i <= variable.

PHP Code:
public cur_weapon() {
    if(
g_KnifeRound) {
        for(new 
033i++)
    {
        if (
is_user_alive(i))
        
engclient_cmd(i"weapon_knife")
    }
  }

There is an id passed in CurWeapon, no need to loop. Although you should find another event for this, as its called on every shot. It can probably be bypassed by binding weapon switching to scrollwheel anyway.

PHP Code:
register_forward(FM_CmdStart"fwd_CmdStart_pre"0); 
Use Ham_Weapon_PrimaryAttack instead. If you were to use cmdstart you should have added an alive check.

PHP Code:
if(is_user_connected(players[i]) == 1)
.... 
Re-index players[ i ].

PHP Code:
is_user_alive(i) && get_user_team(i) == 
Since you include cstrike, use cs_get_user_team( ).

PHP Code:
public CmdRestartRound(idlevelcid) {
    if (!
cmd_access(idlevelcid1)) return PLUGIN_CONTINUE
    g_KnifeRound 
false
    server_cmd
("sv_restartround 1")
    return 
PLUGIN_CONTINUE

Use PLUGIN_HANDLED instead.

PHP Code:
is_user_connected(players[i]) == 
You can safely remove '== 1'.

PHP Code:
public t_win(id) {
    if( 
g_KnifeRound && get_pcvar_num(kr_teamvote)) {
        
set_task(6.0"vote_t")
        
ColorChat(0RED"[KR] T's win,they will decide to swap teams or not shortly!");
    }
}

public 
ct_win(id) {
    if( 
g_KnifeRound && get_pcvar_num(kr_teamvote)) {
        
set_task(6.0"vote_ct")
        
ColorChat(0BLUE"[KR] CT's win, they will decide to swap teams or not shortly!");
    }

No indexes passed in those events.

Last edited by Jon; 10-14-2009 at 13:15.
Jon is offline
floatman
Senior Member
Join Date: Oct 2009
Location: nowhere.
Old 10-14-2009 , 13:37   Re: Knife Round by Juice & tolsty
Reply With Quote #4

Add ML on plugin.
__________________

floatman is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-14-2009 , 14:41   Re: Knife Round by Juice & tolsty
Reply With Quote #5

Quote:
PHP Code:
register_forward(FM_CmdStart"fwd_CmdStart_pre"0); 
Use Ham_Weapon_PrimaryAttack instead. If you were to use cmdstart you should have added an alive check.

PHP Code:
if(is_user_connected(players[i]) == 1)
.... 
Re-index players[ i ].
Sorry, I don't understand

Quote:
No. Store get_maxplayers in a global variable and use i <= variable.
Done.

Quote:
Use PLUGIN_HANDLED instead.
Done.

Quote:
PHP Code:
is_user_connected(players[i]) == 
You can safely remove '== 1'.
Done.

Quote:
PHP Code:
public t_win(id) {
    if( 
g_KnifeRound && get_pcvar_num(kr_teamvote)) {
        
set_task(6.0"vote_t")
        
ColorChat(0RED"[KR] T's win,they will decide to swap teams or not shortly!");
    }
}

public 
ct_win(id) {
    if( 
g_KnifeRound && get_pcvar_num(kr_teamvote)) {
        
set_task(6.0"vote_ct")
        
ColorChat(0BLUE"[KR] CT's win, they will decide to swap teams or not shortly!");
    }

No indexes passed in those events.
Done.

Quote:
Originally Posted by floatman View Post
Add ML on plugin.
Done.

[EDIT] updated to 1.4 version

Last edited by lazarev; 10-14-2009 at 15:44.
lazarev is offline
ditmesteam
Senior Member
Join Date: Oct 2009
Old 10-14-2009 , 14:53   Re: Knife Round by Juice & tolsty
Reply With Quote #6

Can you make this for ghost mode:
- Human can use guns
- Ghost only use knife
Ghost is invisible when move or not move ....
This plugin make my mini server so lag:
http://forums.alliedmods.net/showthread.php?t=89971

Last edited by ditmesteam; 10-14-2009 at 14:56.
ditmesteam is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-14-2009 , 15:46   Re: Knife Round by Juice & tolsty
Reply With Quote #7

Updated to 1.4 version.

1.3 - Small fixes, another Swap Teams method
1.4 - Added multillingual
lazarev is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-14-2009 , 16:52   Re: Knife Round v1.4 by Juice & tolsty
Reply With Quote #8

PHP Code:
for(new 0<= 33i++) 
Noooo...

->

PHP Code:

new g_iMaxPlayers;

public 
plugin_init( )
{
    
g_iMaxPlayers get_maxplayers( );
}

for(new 
0<= g_iMaxPlayersi++) 
PHP Code:
public fwd_CmdStart_pre(iduc_handle) {
    if(
g_KnifeRound && get_pcvar_num(kr_noslash)) {
    static 
button
    button 
get_uc(uc_handleUC_Buttons)
    if(
button IN_ATTACK)
    {
        
button &= ~IN_ATTACK
        button 
|= IN_ATTACK2    
    
}
    
set_uc(uc_handleUC_Buttonsbutton)
    return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

->

PHP Code:

#include <hamsandwich>

RegisterHamHam_Weapon_PrimaryAttack"weapon_knife""FwdKnifePrim" );

public 
FwdKnifePrim(iKnifeWeaponEntity)
{
    if(
g_KnifeRound && get_pcvar_num(kr_noslash))
    {
        
ExecuteHamB(Ham_Weapon_SecondaryAttackiKnifeWeaponEntity);
                    
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;


Last edited by Jon; 10-14-2009 at 16:57.
Jon is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-14-2009 , 17:29   Re: Knife Round v1.5 by Juice & tolsty
Reply With Quote #9

thanks, Jon!

updated to 1.5
lazarev is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 10-15-2009 , 13:43   Re: Knife Round v1.5 by Juice & tolsty
Reply With Quote #10

Quote:
[nl]
KR_STARTED = [KR] Mesronde is gestart!
KR_WIN_CT = [KR] CT's winnen, zij zullen beslissen dat de teams veranderd worden of niet!
KR_WIN_T = [KR] T's winnen, zij zullen beslissen dat de teams veranderd worden of niet!
KR_SWITCH_TEAMS = [KR] Het winnende team heeft besloten om de teams te veranderen!
1. Change the CT's win... & T's win... to only one message. Its annoying to translate twice
2. Why not a message? The winning team has NOT chosen to ...
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
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 12:02.


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