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

Knife Fight 1.5 (09/10/09 Last Update)


Post New Thread Reply   
 
Thread Tools Display Modes
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 04-13-2009 , 14:13   Re: Knife Fight 1.0
Reply With Quote #21

Nice plugin!
AlejandroSk is offline
Send a message via MSN to AlejandroSk
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 04-13-2009 , 15:53   Re: Knife Fight 1.0
Reply With Quote #22

xPaw, wtf? Can't you just write the translations in russian, using Rusiian alphabet and then save the text in UTF-8 format (without BOM)?? Транслит напрягает, честно))
Racoon is offline
Send a message via ICQ to Racoon
fantasist
Member
Join Date: Mar 2009
Old 04-14-2009 , 22:14   Re: Knife Fight 1.0
Reply With Quote #23

In my knife mode modified on CSDM everyone is set to 35hp at spawn, it is very funny with only one stab
fantasist is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-15-2009 , 08:16   Re: Knife Fight 1.0
Reply With Quote #24

PHP Code:
[fin]
HUD_FK Puukko tappelu !!!
HUD_ENABLE = %s on aktivoinut puukko tappelun
ALREADY_ENABLE 
Puukko tappelu on aktivoitu
CMD_NOT 
Sinulla ei ole valtuuksia tuohon komentoon 
SnoW is offline
Send a message via MSN to SnoW
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-15-2009 , 08:47   Re: Knife Fight 1.0
Reply With Quote #25

Hi. Some suggestions you could/should do :

- register_clcmd("say /kf", "cmdkf") <= you forget to define a level for the command. I don't think you want all players able to use this command.
- cmdkf() : in cmd_access(), it should be 1. You define "CMD_NOT" but there is already a key in common.txt : "NO_ACC_COM" . Use new, not static ; for such function which won't called often no need.
- event_round_start() : returning PLUGIN_HANDLED does nothing. You should avoid to return something it will generate less code, you could do the same thing like the cvar in cmdkf().
- fm_strip_user_weapons, fm_give_item : Use strip_user_weapons() and give_item() from fun ; it will be more efficient.
- fw_TouchWeapon() : is_user_connected is useless here, remove it. Check instead if id is between 1 and maxplayer. Cache the value of is_user_bot.

Last edited by Arkshine; 04-15-2009 at 08:49.
Arkshine is offline
Old 04-15-2009, 11:19
alan_el_more
This message has been deleted by alan_el_more.
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 04-15-2009 , 19:21   Re: Knife Fight 1.0
Reply With Quote #26

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>

#define VERSION "1.1"

new g_enablekf_enableg_maxplayersg_IsBot[33], g_IsConnected[33]

public 
plugin_init()
{
    
register_plugin("Knife Fight""VERSION""alan_el_more")
    
register_cvar("kf_version"VERSIONFCVAR_SERVER)
    
register_dictionary("Knife_Fight.txt")
    
g_enable register_cvar("kf_enable""1")
    
register_clcmd("say /kf""cmdkf"ADMIN_KICK)
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeapon")
    
RegisterHam(Ham_Touch"armoury_entity""fw_TouchWeapon")
    
RegisterHam(Ham_Touch"weapon_shield""fw_TouchWeapon")
    
g_maxplayers get_maxplayers()
}

public 
cmdkf(idlevelcid)
{
    if(
get_pcvar_num(g_enable))
    {
        if (!
cmd_access(idlevelcid1))
            return 
PLUGIN_HANDLED;
        
        if(
kf_enable)
        {
            
client_print(idprint_chat"[KF] %L"id"ALREADY_ENABLE")
            return 
PLUGIN_HANDLED;
        }
        
        new 
name[32]
        
get_user_name(idname31)
        
set_hudmessage(255000.30.010.05.01.01.0, -1)
        
show_hudmessage(0"[KF] %L"id"HUD_ENABLE"name)
        
kf_enable true
    
}
    else
        
client_print(idprint_chat"[KF] %L"id"KF_DISABLE")
    
    return 
PLUGIN_CONTINUE
}

public 
event_round_start()
{
    if(!
kf_enable) return;
    
    
set_hudmessage(255000.30.010.05.01.01.0, -1)
    
show_hudmessage(0"[KF] %L"LANG_PLAYER"HUD_KF")
    
    for(new 
id 1id <= g_maxplayersid++)
    {
        if(
is_user_alive(id))
        {
            
strip_user_weapons(id)
            
give_item(id"weapon_knife")
        }
    }
    
    
kf_enable false
}

public 
fw_TouchWeapon(weaponid)
{
    if (
kf_enable && !g_IsBot[id] && (<= id <= g_maxplayers))
        return 
HAM_SUPERCEDE;
    
    return 
HAM_IGNORED;
}

public 
client_putinserverid )
{
    
g_IsConnected[id] = true;
    
    if(
is_user_bot(id))
        
g_IsBot[id] = true;
}

public 
client_disconnect(id)
    
g_IsBot[id] = g_IsConnected[id] = false
Does this well so?
__________________
alan_el_more is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-15-2009 , 19:41   Re: Knife Fight 1.0
Reply With Quote #27

cmdkf() : 0 -> id
fw_TouchWeapon() : do the player check before the bot.
client_putinserver() : Should be g_IsBot[id] = bool:is_user_bot(id);
Arkshine is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 04-15-2009 , 20:13   Re: Knife Fight 1.0
Reply With Quote #28

Quote:
Originally Posted by arkshine View Post
cmdkf() : 0 -> id
fw_TouchWeapon() : do the player check before the bot.
client_putinserver() : Should be g_IsBot[id] = bool:is_user_bot(id);
sorry but i don't understand
__________________
alan_el_more is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-15-2009 , 20:16   Re: Knife Fight 1.0
Reply With Quote #29

Quote:
Originally Posted by arkshine View Post
client_putinserver() : Should be g_IsBot[id] = bool:is_user_bot(id);
Why? It is defaulted to false and when the player that was a bot leaves, it's set to false again.
Therefore, it will always be false in client_putinserver().
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-16-2009 , 05:39   Re: Knife Fight 1.0
Reply With Quote #30

You're right, you're right. I did not read really the code below. Though I would prefer what i've said and removing it in disconnect(). Both is fine, whatever.

Quote:
sorry but i don't understand
show_hudmessage(0, "[KF] %L", id, "HUD_ENABLE", name) : Either you replace 0 by id ( depending if you want to show for all players ) either you keep 0 but you have to change id by LANG_PLAYER.

fw_TouchWeapon() : You check for bots before the check if the id is between 1 and maxplayers. But id in this foward can be > 32 and it will generate an error if so. That's why, do the last check before the bot check.

Last edited by Arkshine; 04-16-2009 at 05:52.
Arkshine is offline
Old 04-16-2009, 08:49
alan_el_more
This message has been deleted by alan_el_more.
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 05:54.


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