Raised This Month: $ Target: $400
 0% 

Knife Round v2.0


Post New Thread Reply   
 
Thread Tools Display Modes
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-21-2009 , 07:48   Re: Knife Round v1.6
Reply With Quote #31

Well done. Here are some things you could/should do:

- CurWeapon event is fired for a specific player, no need to loop through all players.
- If you are looping through all players like you do in the vote functions: player id's range from 1 - maxplayers, not from 0 - mayplayers. The following is correct:
PHP Code:
for(new 1<= g_iMaxPlayersi++) 
- In KnifeRoundStart loop, check for the player being alive first.
- You could pass the winning team through set_task and use only one vote function instead of vote_ct and vote_t separately.
- In SwapTeams you are executing sv_restartround on every loop. This is unnecessary, do it once after the loop has finished.
- In SwapTeams you should first check if the player is spectator or unassigned.
- Why are you only blocking touch for the Scout?
- It may be a good idea to store all the weapons for the following round and regiving them to all the players.
- Why are you mixing get_players() and "manual" looping? This is not a mistake, I'm just interested ;)
__________________
In Flames we trust!
Nextra is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-21-2009 , 08:34   Re: Knife Round v1.6
Reply With Quote #32

Quote:
- Why are you only blocking touch for the Scout?
my bad, i forget to change weapon_scout to weapon_c4 ^^

Quote:
- In SwapTeams you are executing sv_restartround on every loop. This is unnecessary, do it once after the loop has finished.
- In SwapTeams you should first check if the player is spectator or unassigned.
Done.

Quote:
- You could pass the winning team through set_task and use only one vote function instead of vote_ct and vote_t separately.
Tolsty made a vote for me, ok I will try to do something... =)

Quote:
- If you are looping through all players like you do in the vote functions: player id's range from 1 - maxplayers, not from 0 - mayplayers.
ok =))

Last edited by lazarev; 10-21-2009 at 08:47.
lazarev is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-21-2009 , 12:57   Re: Knife Round v1.6
Reply With Quote #33

This plugin is redundant but does the job better than the other similar plugins out there.

There are a few mistakes and optimizations that can be made, however it is acceptable.

If you would like any information regarding possible adjustments you could make or things you could do to make this better, please feel free to post here or PM me.

Approved.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-21-2009 , 17:07   Re: Knife Round v1.7
Reply With Quote #34

PHP Code:
if (team == CS_TEAM_SPECTATOR) return PLUGIN_HANDLED
Do that before you are setting the team. Otherwise you will be switching spectators to terror team. Don't return PLUGIN_HANDLED, just use "continue" or you will stop the loop. Also you need to check for CS_TEAM_UNASSIGNED aswell.

PHP Code:
    get_players(playersg_iMaxPlayers)
    
    for(new 
0g_iMaxPlayers i++) 
That's why I asked for you using both get_players and "manual" looping. You are mixing things up and therefore making mistakes. g_iMaxPlayers is not to be used when you use get_players, you need a separate variable (local) for the second value. Looping through 1-maxplayers and players[] is different. I'd suggest you to only use one of the two methods.

PHP Code:
        if (weapon != CSW_KNIFE && is_user_alive(i)) 
You can (or should) check is_user_alive even before getting the weapon.
__________________
In Flames we trust!
Nextra is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-22-2009 , 03:05   Re: Knife Round v1.8
Reply With Quote #35

Updated to 1.8
lazarev is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-22-2009 , 03:55   Re: Knife Round v1.8
Reply With Quote #36

PHP Code:
public cur_weapon() {
    if(
g_KnifeRound) {
        for(new 
1<= g_iMaxPlayersi++)
    {
        if (
is_user_alive(i))
        
engclient_cmd(i"weapon_knife")
    }
  }

You fail.
Jon is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-22-2009 , 08:04   Re: Knife Round v1.8
Reply With Quote #37

^^
lazarev is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-22-2009 , 10:11   Re: Knife Round v1.8
Reply With Quote #38

I'm not a plugin approver. BUT: This plugin has several stupid mistakes and should never have been approved. See post #33 too.

Yet again:
PHP Code:
register_event("CurWeapon""cur_weapon""be""1=0""2=29")

public 
cur_weapon() {
    if(
g_KnifeRound) {
        for(new 
1<= g_iMaxPlayersi++)
    {
        if (
is_user_alive(i))
        
engclient_cmd(i"weapon_knife")
    }
  }

This is a wrong and a terrible way to block players using other weapons than knife.


PHP Code:
public KnifeRoundStart(id) {
    
g_KnifeRound true;
    for(new 
0<= g_iMaxPlayersi++)
    {
        new 
weapon get_user_weapon(id)
        if (
is_user_alive(i) && weapon != CSW_KNIFE
            
engclient_cmd(i"weapon_knife")
    }

Retriving weapon from the wrong index.

PHP Code:
for(new 0<= g_iMaxPlayersi++) 
3 loops are using this code, which is wrong.

PHP Code:
register_clcmd("shield""shield_block")

public 
shield_block(id) {
    if(
g_KnifeRound) {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

Won't work at all.

Last edited by Jon; 10-22-2009 at 10:14.
Jon is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-22-2009 , 10:42   Re: Knife Round v1.8
Reply With Quote #39

Quote:
Originally Posted by Jon View Post
I'm not a plugin approver. BUT: This plugin has several stupid mistakes and should never have been approved. See post #33 too.
Yeah, I just looked through 6 pages of plugins, which took me over 2 hours. I usually miss things like this or unapprove a few plugins by accident when I write that I'm going to approve it or vice-versa.

Anyway, unapproved until those problems are fixed.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-22-2009 , 17:17   Re: Knife Round v1.9
Reply With Quote #40

Updated to 1.9, check the code please =)
lazarev 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 00:28.


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