Все привет, интересует такой вопрос, возможно ли сделать так чтобы ksg и kill_assist работали в связки, ну или чтобы если ksg обнаружил рекламу в нике kill_assist не пытался каждый новый раунд вернуть изначальное имя игрока
Код:
/* --------------------------------------------------------------------------
Kill assist (for CS) v1.2
by Digi (a.k.a. Hunter-Digital)
www.thehunters.ro
-----------------------------------------------------------------
Description:
When a player gets killed, this plugin checks if another player, from the same team,
did enough damage to the victim so that he could be an accomplice to the kill and
the assister will also receive a frag
(all of these are cvar controlled)
CVars and default values:
- amx_killassist_enable 0/1/2 (default: 1)
Enable modes: 0 = Disable / 1 = Enable with DeathMsg / 2 = Enable with HUD message
- amx_killassist_mindamage 1-9999 (default: 50)
Minimum amount of damage to deal to be nominated for an assisted kill
- amx_killassist_givefrags 0/1 (default: 1)
Give or not give the assister frags
- amx_killassist_givemoney 0-16000 (default: 300)
Give or not give the assister some money, 0 disables, 1 or more sets how much money
- amx_killassist_onlyalive 0/1 (default: 0)
Only alive players can be of assistance in killing other players
Credits and thanks:
- ConnorMcLeod - for helping with quick name changing
- arkshine - for helping with name squeeze
- joaquimandrade - code improvements
- anakin_cstrike - code improvements
- Nextra - more code improvements
- ajvn - some ideas
- Dores - and more code improvements
- frearmer - hud message sugestion
Changelog:
v1.0 - Release
v1.0b - Fixed admin name bug
v1.0c - Some modifications and added g_bOnline
v1.0d - Removed useless stuff xD, added pcvar on amx_mode and used formatex()
v1.1 - converted to CS only, new cvars: amx_killassist_onlyalive, amx_killassist_givemoney
v1.1b - simplified cvar checking using clamp()
v1.2 - added no-name-changing support, prints HUD message, to activate, set enabled to 2
-------------------------------------------------------------- */
/* Feel free to modify these HUD message values */
#define HUD_colorR 255 // default: 255
#define HUD_colorG 155 // default: 155
#define HUD_colorB 0 // default: 0
#define HUD_posX 0.6 // default: 0.6
#define HUD_posY 0.2 // default: 0.2
#define HUD_fx 0 // default: 0
#define HUD_fxTime 0.0 // default: 0.0
#define HUD_holdTime 1.0 // default: 1.0
#define HUD_fadeInTime 0.3 // default: 0.3
#define HUD_fadeOutTime 2.0 // default: 2.0
#define HUD_channel -1 // default: -1
/* -------------------------------------------------------------------------
Nothing to edit below this point */
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>
#define PLUGIN_TITLE "Kill assist (for CS)"
#define PLUGIN_VERSION "1.2"
#define PLUGIN_AUTHOR "Digi (a.k.a. Hunter-Digital)"
#define PLUGIN_PUBLICVAR "plugin_killassist"
#define MAXPLAYERS 32 + 1
#define TEAM_NONE 0
#define TEAM_TE 1
#define TEAM_CT 2
#define TEAM_SPEC 3
#define is_player(%1) (1 <= %1 <= g_iMaxPlayers)
new msgID_sayText
new msgID_deathMsg
new msgID_scoreInfo
new msgID_money
new pCVar_amxMode
new pCVar_enabled
new pCVar_minDamage
new pCVar_giveFrags
new pCVar_giveMoney
new pCVar_onlyAlive
new ch_pCVar_enabled
new ch_pCVar_minDamage
new ch_pCVar_giveFrags
new ch_pCVar_giveMoney
new ch_pCVar_onlyAlive
new g_szName[MAXPLAYERS][32]
new g_iTeam[MAXPLAYERS]
new g_iDamage[MAXPLAYERS][MAXPLAYERS]
new bool:g_bAlive[MAXPLAYERS] = {false, ...}
new bool:g_bOnline[MAXPLAYERS] = {false, ...}
new g_iLastAmxMode
new g_iMaxPlayers = 0
new bool:g_bAmxModeExists = false
public plugin_init()
{
register_plugin(PLUGIN_TITLE, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_cvar(PLUGIN_PUBLICVAR, PLUGIN_VERSION, FCVAR_SERVER)
pCVar_enabled = register_cvar("amx_killassist_enabled", "0")
pCVar_minDamage = register_cvar("amx_killassist_mindamage", "50")
pCVar_giveFrags = register_cvar("amx_killassist_givefrags", "1")
pCVar_giveMoney = register_cvar("amx_killassist_givemoney", "300")
pCVar_onlyAlive = register_cvar("amx_killassist_onlyalive", "0")
if(cvar_exists("amx_mode"))
{
pCVar_amxMode = get_cvar_pointer("amx_mode")
g_bAmxModeExists = true
}
msgID_money = get_user_msgid("Money")
msgID_sayText = get_user_msgid("SayText")
msgID_deathMsg = get_user_msgid("DeathMsg")
msgID_scoreInfo = get_user_msgid("ScoreInfo")
register_message(msgID_deathMsg, "msg_deathMsg")
register_logevent("event_roundStart", 2, "1=Round_Start")
register_event("Damage", "player_damage", "be", "2!0", "3=0", "4!0")
register_event("DeathMsg", "player_die", "ae")
register_event("TeamInfo", "player_joinTeam", "a")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
g_iMaxPlayers = get_maxplayers()
}
public plugin_cfg() event_roundStart()
public event_roundStart()
{
ch_pCVar_enabled = clamp(get_pcvar_num(pCVar_enabled), 0, 2)
ch_pCVar_minDamage = clamp(get_pcvar_num(pCVar_minDamage), 0, 9999)
ch_pCVar_giveFrags = clamp(get_pcvar_num(pCVar_giveFrags), 0, 1)
ch_pCVar_giveMoney = clamp(get_pcvar_num(pCVar_giveMoney), 0, 16000)
ch_pCVar_onlyAlive = clamp(get_pcvar_num(pCVar_onlyAlive), 0, 1)
}
public client_putinserver(iPlayer)
{
g_bOnline[iPlayer] = true
get_user_name(iPlayer, g_szName[iPlayer], 31)
}
public client_disconnect(iPlayer)
{
g_iTeam[iPlayer] = TEAM_NONE
g_bAlive[iPlayer] = false
g_bOnline[iPlayer] = false
}
public player_joinTeam()
{
static iPlayer, szTeam[2]
iPlayer = read_data(1)
read_data(2, szTeam, 1)
switch(szTeam[0])
{
case 'T': g_iTeam[iPlayer] = TEAM_TE
case 'C': g_iTeam[iPlayer] = TEAM_CT
default: g_iTeam[iPlayer] = TEAM_SPEC // since you can't transfer yourself to unsigned team...
}
return PLUGIN_CONTINUE
}
public player_spawn(iPlayer)
{
if(!is_user_alive(iPlayer))
return HAM_IGNORED
g_bAlive[iPlayer] = true // he's alive !
static p, szName[32]
get_user_name(iPlayer, szName, 31)
if(!equali(szName, g_szName[iPlayer])) // make sure he has his name !
{
set_msg_block(msgID_sayText, BLOCK_ONCE)
set_user_info(iPlayer, "name", g_szName[iPlayer])
}
// reset damage meters
for(p = 1; p <= g_iMaxPlayers; p++)
g_iDamage[iPlayer][p] = 0
return HAM_IGNORED
}
public player_damage(iVictim)
{
if(!ch_pCVar_enabled || !is_player(iVictim))
return PLUGIN_CONTINUE
static iAttacker
iAttacker = get_user_attacker(iVictim)
if(!is_player(iAttacker))
return PLUGIN_CONTINUE
g_iDamage[iAttacker][iVictim] += read_data(2)
return PLUGIN_CONTINUE
}
public player_die()
{
if(!ch_pCVar_enabled)
return PLUGIN_CONTINUE
static iVictim, iKiller
iVictim = read_data(2)
iKiller = read_data(1)
if(!is_player(iVictim))
return PLUGIN_CONTINUE
g_bAlive[iVictim] = false
if(!is_player(iKiller))
return PLUGIN_CONTINUE
static szWeapon[24], iHS, iKillerTeam
iKillerTeam = g_iTeam[iKiller]
iHS = read_data(3)
read_data(4, szWeapon, 23)
if(iKiller != iVictim && g_iTeam[iVictim] != iKillerTeam)
{
static iKiller2, iDamage2, p
iKiller2 = 0
iDamage2 = 0
for(p = 1; p <= g_iMaxPlayers; p++)
{
if(p != iKiller && g_bOnline[p] && (ch_pCVar_onlyAlive && g_bAlive[p] || !ch_pCVar_onlyAlive) && iKillerTeam == g_iTeam[p] && g_iDamage[p][iVictim] >= ch_pCVar_minDamage && g_iDamage[p][iVictim] > iDamage2)
{
iKiller2 = p
iDamage2 = g_iDamage[p][iVictim]
}
g_iDamage[p][iVictim] = 0
}
if(iKiller2 > 0 && iDamage2 > ch_pCVar_minDamage)
{
if(ch_pCVar_giveFrags)
{
static iFrags
iFrags = get_user_frags(iKiller2)+1
set_user_frags(iKiller2, iFrags)
message_begin(MSG_ALL, msgID_scoreInfo)
write_byte(iKiller2)
write_short(iFrags)
write_short(get_user_deaths(iKiller2))
write_short(0)
write_short(iKillerTeam)
message_end()
}
if(ch_pCVar_giveMoney)
{
static iMoney
iMoney = cs_get_user_money(iKiller2) + ch_pCVar_giveMoney
if(iMoney > 16000)
iMoney = 16000
cs_set_user_money(iKiller2, iMoney)
if(g_bAlive[iKiller2]) // no reason to send a money message when the player has no hud :}
{
message_begin(MSG_ONE_UNRELIABLE, msgID_money, _, iKiller2)
write_long(iMoney)
write_byte(1)
message_end()
}
}
if(ch_pCVar_enabled == 2)
{
static szName1[32], szName2[32], szName3[32], szMsg[128]
get_user_name(iKiller, szName1, 31)
get_user_name(iKiller2, szName2, 31)
get_user_name(iVictim, szName3, 31)
formatex(szMsg, 63, "%s killed %s assisted by %s", szName1, szName3, szName2)
set_hudmessage(HUD_colorR, HUD_colorG, HUD_colorB, HUD_posX, HUD_posY, HUD_fx, HUD_fxTime, HUD_holdTime, HUD_fadeInTime, HUD_fadeOutTime, HUD_channel)
show_hudmessage(0, szMsg)
}
else
{
static szName1[32], iName1Len, szName2[32], iName2Len, szNames[32], szWeaponLong[32]
iName1Len = get_user_name(iKiller, szName1, 31)
iName2Len = get_user_name(iKiller2, szName2, 31)
g_szName[iKiller] = szName1
if(iName1Len < 14)
{
formatex(szName1, iName1Len, "%s", szName1)
formatex(szName2, 28-iName1Len, "%s", szName2)
}
else if(iName2Len < 14)
{
formatex(szName1, 28-iName2Len, "%s", szName1)
formatex(szName2, iName2Len, "%s", szName2)
}
else
{
formatex(szName1, 13, "%s", szName1)
formatex(szName2, 13, "%s", szName2)
}
formatex(szNames, 31, "%s + %s", szName1, szName2)
set_msg_block(msgID_sayText, BLOCK_ONCE)
set_user_info(iKiller, "name", szNames)
if(g_bAmxModeExists)
{
g_iLastAmxMode = get_pcvar_num(pCVar_amxMode)
set_pcvar_num(pCVar_amxMode, 0)
}
if(equali(szWeapon, "grenade"))
szWeaponLong = "weapon_hegrenade"
else
formatex(szWeaponLong, 31, "weapon_%s", szWeapon)
static args[4]
args[0] = iVictim
args[1] = iKiller
args[2] = iHS
args[3] = get_weaponid(szWeaponLong)
set_task(0.1, "player_diePost", 0, args, 4)
}
}
else if(ch_pCVar_enabled == 1)
do_deathmsg(iKiller, iVictim, iHS, szWeapon)
}
else if(ch_pCVar_enabled == 1)
do_deathmsg(iKiller, iVictim, iHS, szWeapon)
return PLUGIN_CONTINUE
}
public player_diePost(arg[])
{
static iKiller, szWeapon[24]
iKiller = arg[1]
get_weaponname(arg[3], szWeapon, 23)
replace(szWeapon, 23, "weapon_", "")
do_deathmsg(iKiller, arg[0], arg[2], szWeapon)
set_msg_block(msgID_sayText, BLOCK_ONCE)
set_user_info(iKiller, "name", g_szName[iKiller])
if(g_bAmxModeExists)
set_pcvar_num(pCVar_amxMode, g_iLastAmxMode)
return PLUGIN_CONTINUE
}
public msg_deathMsg() return ch_pCVar_enabled == 1 ? PLUGIN_HANDLED : PLUGIN_CONTINUE
/* originally from messages_stocks.inc, but simplified */
stock do_deathmsg(iKiller, iVictim, iHS, const szWeapon[])
{
message_begin(MSG_ALL, msgID_deathMsg)
write_byte(iKiller)
write_byte(iVictim)
write_byte(iHS)
write_string(szWeapon)
message_end()
}
/* --------------------------------------------------------------------------
EOF
-------------------------------------------------------------- */
Код:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Key & Say Guardian"
#define VERSION "1.3b"
#define AUTHOR "AndrewZ / noskill"
#define TID_NAMEPUNISH 1000
#define TID_SAYMENU 2000
#define TID_NAMEMENU 3000
#define MAX_SPAM_MSGS 10
new BLOCKED_MESSAGES[ 128 ][ 192 ],
BLOCKED_NAMES[ 128 ][ 32 ],
BLOCKED_KEYS[ 128 ][ 12 ]
new bool:g_saykey_used[ 33 ], bool:g_namekey_used[ 33 ]
new g_spam_messages[ 33 ][ MAX_SPAM_MSGS + 1 ][ 192 ],
g_spam_count[ 33 ],
g_namemenu_displayed[ 33 ],
g_cheatkey_warns[ 33 ]
new pcv_immunity_flag, pcv_immunity_steam,
pcv_sayguard_mode, pcv_sayguard_repeat, pcv_sayguard_repeat_len,
pcv_nameguard_mode, pcv_nameguard_newname,
pcv_keyguard_enable, pcv_keyguard_warns, pcv_keyguard_bantime, pcv_keyguard_punish
new g_configs_dir[ 64 ], g_maxplayers, g_bindkeys_line
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR )
register_event( "ResetHUD", "event_resethud", "b" )
register_clcmd( "KSGkey", "cheatkey_punish" )
register_clcmd( "say", "hook_say" )
register_clcmd( "say_team", "hook_say" )
pcv_immunity_flag = register_cvar( "ksg_immunity_flag", "a" )
pcv_immunity_steam = register_cvar( "ksg_immunity_steam", "1" )
pcv_sayguard_mode = register_cvar( "ksg_sayguard_mode", "2" )
pcv_sayguard_repeat = register_cvar( "ksg_sayguard_repeat", "1" )
pcv_sayguard_repeat_len = register_cvar( "ksg_sayguard_repeat_len", "13" )
pcv_nameguard_mode = register_cvar( "ksg_nameguard_mode", "2" )
pcv_nameguard_newname = register_cvar( "ksg_nameguard_newname", "[KSG] Player" )
pcv_keyguard_enable = register_cvar( "ksg_keyguard_enable", "1" )
pcv_keyguard_warns = register_cvar( "ksg_keyguard_warns", "3" )
pcv_keyguard_bantime = register_cvar( "ksg_keyguard_bantime", "240" )
pcv_keyguard_punish = register_cvar( "ksg_keyguard_punish", "kick %userid% %reason%" )
register_cvar( "ksg_version", VERSION, FCVAR_SPONLY | FCVAR_SERVER )
set_cvar_string( "ksg_version", VERSION )
register_dictionary( "ksg.txt" )
register_menu( "show_sayguard_menu", -1, "handler_sayguard_menu" )
register_menu( "show_nameguard_menu", -1, "handler_nameguard_menu" )
g_maxplayers = get_maxplayers()
set_task( 5.0, "task_bind_keys", _, _, _, "b" )
set_task( 1.0, "task_plugin_init" )
}
public plugin_cfg()
{
get_configsdir( g_configs_dir, 64 )
server_cmd( "exec %s/ksg/ksg_config.cfg", g_configs_dir )
}
public task_plugin_init()
{
new temp[ 64 ]; format( temp, 63, "%s/ksg/ksg_messages.ini", g_configs_dir )
if( file_exists( temp ) )
{
new line, textsize, text[ 128 ], i
while( read_file( temp, line, text, 255, textsize ) )
{
BLOCKED_MESSAGES[ i ++ ] = text
line ++
}
}
format( temp, 63, "%s/ksg/ksg_names.ini", g_configs_dir )
if( file_exists( temp ) )
{
new line, textsize, text[ 32 ], i
while( read_file( temp, line, text, 255, textsize ) )
{
BLOCKED_NAMES[ i ++ ] = text
line ++
}
}
format( temp, 63, "%s/ksg/ksg_keys.ini", g_configs_dir )
if( file_exists( temp ) )
{
new textsize, text[ 12 ], i
while( read_file( temp, g_bindkeys_line, text, 255, textsize ) )
{
BLOCKED_KEYS[ i ++ ] = text
g_bindkeys_line ++
}
}
}
public task_bind_keys()
{
for( new id = 1; id <= g_maxplayers; id ++ )
{
if( is_user_connected( id ) )
{
if( !is_user_steam( id ) )
{
if( !get_client_status( id ) )
bind_keys( id )
}
}
}
}
public bind_keys( id )
{
for( new i; i < g_bindkeys_line; i ++ )
{
if( !equali( BLOCKED_KEYS[ i ], " " ) )
client_cmd( id, "bind ^"%s^" ^"KSGkey %s^"", BLOCKED_KEYS[ i ], BLOCKED_KEYS[ i ] )
}
}
public client_connect( id )
{
g_namekey_used[ id ] = false
g_saykey_used[ id ] = false
g_namemenu_displayed[ id ] = 0
g_spam_count[ id ] = 0
g_cheatkey_warns[ id ] = 0
}
public event_resethud( id )
{
if( get_pcvar_num( pcv_nameguard_mode ) )
{
if( is_user_alive( id ) )
{
if( !get_client_status( id ) )
set_task( 5.0, "name_punish", id + TID_NAMEPUNISH )
}
}
}
public hook_say( id )
{
new sayguard_mode = get_pcvar_num( pcv_sayguard_mode )
new sayguard_repeat = get_pcvar_num( pcv_sayguard_repeat )
if( sayguard_mode || sayguard_repeat )
{
if( !get_client_status( id ) )
{
new said[ 192 ]
read_args( said, 191 )
remove_quotes( said )
if( sayguard_mode )
{
for( new i; i < sizeof( BLOCKED_MESSAGES ); i ++ )
{
if( containi( said, BLOCKED_MESSAGES[ i ] ) != -1 )
{
switch( sayguard_mode )
{
case 1: return PLUGIN_HANDLED
case 2:
{
if( is_user_steam( id ) )
{
set_task( 0.1, "say_punish_menu", id + TID_SAYMENU, said, 192 )
return PLUGIN_HANDLED
}
else return PLUGIN_HANDLED
}
}
}
}
}
if( sayguard_repeat )
{
if( strlen( said ) > get_pcvar_num( pcv_sayguard_repeat_len ) )
{
for( new i; i <= MAX_SPAM_MSGS; i ++ )
{
if( equal( g_spam_messages[ id ][ i ], said ) )
{
new file[ 256 ], log[ 128 ], name[ 32 ], authid[ 35 ], ip[ 23 ]
get_user_name( id, name, 31 ); get_user_authid( id, authid, 34 ); get_user_ip( id, ip, 22, 1 )
format( log, 127, "%s: %s (AuthID:[%s], IP:[%s])", name, said , authid, ip )
format( file, 255, "%s/ksg/logs/ksg_repeat_messages.txt", g_configs_dir )
log_to_file( file, log )
return PLUGIN_HANDLED
}
}
if( g_spam_count[ id ] == MAX_SPAM_MSGS )
g_spam_count[ id ] = 0
g_spam_count[ id ] ++
g_spam_messages[ id ][ g_spam_count[ id ] ] = said
}
}
}
}
return PLUGIN_CONTINUE
}
public say_punish_menu( said[], id )
{
id -= TID_SAYMENU
new menu[ 512 ], len, keys = MENU_KEY_1 + MENU_KEY_2
len = formatex( menu, charsmax( menu ), "\rKey&Say Guardian v%s", VERSION )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\y%L", id, "KSG_SPAM_DTCTD" )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\d^"%s^"", said )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\y%L", id, "KSG_SPAM_DTCTD2" )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n^n\r1.\w %L", id, "KSG_SPAM_YES" )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\r2.\w %L", id, "KSG_SPAM_NO" )
if( !g_saykey_used[ id ] )
{
len += formatex( menu[ len ], charsmax( menu ) - len, "^n^n\r3.\w %L", id, "KSG_SPAM_KEY" )
keys += MENU_KEY_3
}
show_menu( id, keys, menu, _, "show_sayguard_menu" )
}
public handler_sayguard_menu( id, key )
{
key ++
switch( key )
{
case 1: restore_config( id )
case 2: client_cmd( id, "disconnect" )
case 3:
{
g_saykey_used[ id ] = true
client_printcolor( id, "^1[^4K&SG^1] %L", id, "KSG_SPAM_RULES" )
}
}
}
public name_punish( id )
{
id -= TID_NAMEPUNISH
new nameguard_mode = get_pcvar_num( pcv_nameguard_mode )
if( nameguard_mode )
{
new name[ 32 ]; get_user_name( id, name, 31 )
new userid = get_user_userid( id )
for( new i = 0; i < sizeof( BLOCKED_NAMES ); i ++ )
{
if( containi( name, BLOCKED_NAMES[ i ] ) != -1 )
{
switch( nameguard_mode )
{
case 1: server_cmd( "kick #%d ^"[Online] %L^"", userid, LANG_SERVER, "KSG_NAME_DTCTD" )
case 2:
{
if( g_namekey_used[ id ] )
server_cmd( "kick #%d ^"[Online] %L^"", userid, LANG_SERVER, "KSG_NAME_DTCTD" )
else
{
if( g_namemenu_displayed[ id ] < 2 )
set_task( 0.1, "name_punish_menu", id + TID_NAMEMENU, name, 32 )
else
server_cmd( "kick #%d ^"[Online] %L^"", userid, LANG_SERVER, "KSG_NAME_DTCTD" )
}
}
case 3:
{
new nameguard_mode[ 64 ]
get_pcvar_string( pcv_nameguard_newname, nameguard_mode, 63 )
set_user_info( id, "name", nameguard_mode )
}
}
}
}
}
}
public name_punish_menu( name[], id )
{
id -= TID_NAMEMENU
new menu[ 512 ], len, keys = MENU_KEY_1 + MENU_KEY_2
len = formatex( menu, charsmax( menu ), "\rKey&Say Guardian v%s", VERSION )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\y%L", id, "KSG_NAME_DTCTD" )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\d^"%s^"", name )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\y%L", id, "KSG_NAME_DTCTD2" )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n^n\r1.\w %L", id, "KSG_NAME_YES" )
len += formatex( menu[ len ], charsmax( menu ) - len, "^n\r2.\w %L", id, "KSG_NAME_NO" )
if( !g_namekey_used[ id ] )
{
len += formatex( menu[ len ], charsmax( menu ) - len, "^n^n\r3.\w %L", id, "KSG_NAME_KEY" )
keys += MENU_KEY_3
}
show_menu( id, keys, menu, _, "show_nameguard_menu" )
g_namemenu_displayed[ id ] ++
}
public handler_nameguard_menu( id, key )
{
key ++
switch( key )
{
case 1:
{
new nameguard_mode[ 64 ]; get_pcvar_string( pcv_nameguard_newname, nameguard_mode, 63 )
set_user_info( id, "name", nameguard_mode )
}
case 2: client_cmd( id, "disconnect" )
case 3:
{
g_namekey_used[ id ] = true
client_printcolor( id, "^1[^4K&SG^1] %L", id, "KSG_NAME_RULES" )
}
}
}
public cheatkey_punish( id )
{
new keyguard = get_pcvar_num( pcv_keyguard_enable )
if( keyguard )
{
if( !get_client_status( id ) )
{
new key[ 8 ]; read_args( key, 7 )
new name[ 32 ]; get_user_name( id, name, 31 )
new ip[ 16 ]; get_user_ip( id, ip, 15, 1 )
new steamid[ 35 ]; get_user_authid( id, steamid, 34 )
new punish[ 256 ]; get_pcvar_string( pcv_keyguard_punish, punish, 255 )
new bantime[ 16 ]; get_pcvar_string( pcv_keyguard_bantime, bantime, 15 )
new userid = get_user_userid( id )
switch( keyguard )
{
case 1:
{
for( new i = 1; i <= g_maxplayers; i ++ )
{
if( is_user_connected( i ) && is_user_admin( i ) )
client_printcolor( i, "^1[^4K&SG^1] %L", i, "KSG_CHEATKEY_USE", name, key )
}
}
case 2:
{
for( new i = 1; i <= g_maxplayers; i ++ )
{
if( is_user_connected( i ) && is_user_admin( i ) )
client_printcolor( i, "^1[^4K&SG^1] %L", i, "KSG_CHEATKEY_USE", name, key )
}
g_cheatkey_warns[ id ] ++
if( g_cheatkey_warns[ id ] > get_pcvar_num( pcv_keyguard_warns ) )
{
new name_temp[ 36 ], reason_temp[ 128 ], userid_temp[ 37 ]
format( name_temp, charsmax( name_temp ), "^"%s^"", name )
replace_all( punish, charsmax( punish ), "%username%", name )
format( reason_temp, charsmax( reason_temp ), "^"[Online] %L^"", LANG_SERVER, "KSG_CHEATKEY_DTCTD" )
replace_all( punish, charsmax( punish ), "%reason%", reason_temp )
format( userid_temp, charsmax( userid_temp ), "#%d", userid )
replace_all( punish, charsmax( punish ), "%userid%", userid_temp )
replace_all( punish, charsmax( punish ), "%userip%", ip )
replace_all( punish, charsmax( punish ), "%steamid%", steamid )
replace_all( punish, charsmax( punish ), "%bantime%", bantime )
server_cmd( punish )
return PLUGIN_HANDLED
}
client_printcolor( id, "^1[^4K&SG^1] %L", id, "KSG_CHEATKEY_WARN" )
}
}
}
}
return PLUGIN_HANDLED
}
public restore_config( id )
{
client_cmd( id, "unbindall" )
client_cmd( id, "bind ^"TAB^" ^"+showscores^"" )
client_cmd( id, "bind ^"ENTER^" ^"+attack^"" )
client_cmd( id, "bind ^"ESCAPE^" ^"escape^"" )
client_cmd( id, "bind ^"SPACE^" ^"+jump^"" )
client_cmd( id, "bind ^"'^" ^"+moveup^"" )
client_cmd( id, "bind ^"+^" ^"sizeup^"" )
client_cmd( id, "bind ^",^" ^"buyammo1^"" )
client_cmd( id, "bind ^"-^" ^"sizedown^"" )
client_cmd( id, "bind ^".^" ^"buyammo2^"" )
client_cmd( id, "bind ^"/^" ^"+movedown^"" )
client_cmd( id, "bind ^"0^" ^"slot10^"" )
client_cmd( id, "bind ^"1^" ^"slot1^"" )
client_cmd( id, "bind ^"2^" ^"slot2^"" )
client_cmd( id, "bind ^"3^" ^"slot3^"" )
client_cmd( id, "bind ^"4^" ^"slot4^"" )
client_cmd( id, "bind ^"5^" ^"slot5^"" )
client_cmd( id, "bind ^"6^" ^"slot6^"" )
client_cmd( id, "bind ^"7^" ^"slot7^"" )
client_cmd( id, "bind ^"8^" ^"slot8^"" )
client_cmd( id, "bind ^"9^" ^"slot9^"" )
client_cmd( id, "bind ^";^" ^"+mlook^"" )
client_cmd( id, "bind ^"=^" ^"sizeup^"" )
client_cmd( id, "bind ^"a^" ^"+moveleft^"" )
client_cmd( id, "bind ^"b^" ^"buy^"" )
client_cmd( id, "bind ^"c^" ^"radio3^"" )
client_cmd( id, "bind ^"d^" ^"+moveright^"" )
client_cmd( id, "bind ^"e^" ^"+use^"" )
client_cmd( id, "bind ^"f^" ^"impulse 100^"" )
client_cmd( id, "bind ^"g^" ^"drop^"" )
client_cmd( id, "bind ^"h^" ^"+commandmenu^"" )
client_cmd( id, "bind ^"i^" ^"showbriefing^"" )
client_cmd( id, "bind ^"j^" ^"cheer^"" )
client_cmd( id, "bind ^"k^" ^"+voicerecord^"" )
client_cmd( id, "bind ^"m^" ^"chooseteam^"" )
client_cmd( id, "bind ^"n^" ^"nightvision^"" )
client_cmd( id, "bind ^"o^" ^"buyequip^"" )
client_cmd( id, "bind ^"q^" ^"lastinv^"" )
client_cmd( id, "bind ^"r^" ^"+reload^"" )
client_cmd( id, "bind ^"s^" ^"+back^"" )
client_cmd( id, "bind ^"t^" ^"impulse 201^"" )
client_cmd( id, "bind ^"u^" ^"messagemode2^"" )
client_cmd( id, "bind ^"w^" ^"+forward^"" )
client_cmd( id, "bind ^"x^" ^"radio2^"" )
client_cmd( id, "bind ^"y^" ^"messagemode^"" )
client_cmd( id, "bind ^"z^" ^"radio1^"" )
client_cmd( id, "bind ^"[^" ^"invprev^"" )
client_cmd( id, "bind ^"]^" ^"invnext^"" )
client_cmd( id, "bind ^"`^" ^"toggleconsole^"" )
client_cmd( id, "bind ^"~^" ^"toggleconsole^"" )
client_cmd( id, "bind ^"UPARROW^" ^"+forward^"" )
client_cmd( id, "bind ^"DOWNARROW^" ^"+back^"" )
client_cmd( id, "bind ^"LEFTARROW^" ^"+left^"" )
client_cmd( id, "bind ^"RIGHTARROW^" ^"+right^"" )
client_cmd( id, "bind ^"ALT^" ^"+strafe^"" )
client_cmd( id, "bind ^"CTRL^" ^"+duck^"" )
client_cmd( id, "bind ^"SHIFT^" ^"+speed^"" )
client_cmd( id, "bind ^"F1^" ^"autobuy^"" )
client_cmd( id, "bind ^"F2^" ^"rebuy^"" )
client_cmd( id, "bind ^"F5^" ^"snapshot^"" )
client_cmd( id, "bind ^"F6^" ^"save quick^"" )
client_cmd( id, "bind ^"F7^" ^"load quick^"" )
client_cmd( id, "bind ^"F10^" ^"quit prompt^"" )
client_cmd( id, "bind ^"INS^" ^"+klook^"" )
client_cmd( id, "bind ^"PGDN^" ^"+lookdown^"" )
client_cmd( id, "bind ^"PGUP^" ^"+lookup^"" )
client_cmd( id, "bind ^"END^" ^"centerview^"" )
client_cmd( id, "bind ^"MWHEELDOWN^" ^"invnext^"" )
client_cmd( id, "bind ^"MWHEELUP^" ^"invprev^"" )
client_cmd( id, "bind ^"MOUSE1^" ^"+attack^"" )
client_cmd( id, "bind ^"MOUSE2^" ^"+attack2^"" )
client_cmd( id, "bind ^"PAUSE^" ^"pause^"" )
bind_keys( id )
}
stock get_client_status( id )
{
if( is_user_bot( id ) ) return 1
else if( is_user_hltv( id ) ) return 2
new flags[ 23 ]; get_pcvar_string( pcv_immunity_flag, flags, charsmax( flags ) )
if( get_user_flags( id ) & read_flags( flags ) ) return 3
return 0
}
stock bool:is_user_steam( id ) // ty, Sh0oter
{
if( get_pcvar_num( pcv_immunity_steam ) )
{
static dp_pointer
if( dp_pointer || ( dp_pointer = get_cvar_pointer( "dp_r_id_provider" ) ) )
{
server_cmd( "dp_clientinfo %d", id )
server_exec()
return ( get_pcvar_num( dp_pointer ) == 2 ) ? true : false
}
return false
}
return true
}
stock client_printcolor( const id, const input[], any:... )
{
new count = 1, players[ 32 ]
static msg[ 191 ]
vformat( msg, 190, input, 3 )
replace_all( msg, 190, "!g", "^4" ) // Green Color
replace_all( msg, 190, "!n", "^1" ) // Default Color
replace_all( msg, 190, "!t", "^3" ) // Team Color
if( id ) players[ 0 ] = id; else get_players( players, count, "ch" )
{
for( new i = 0; i < count; i ++ )
{
if( is_user_connected( players[ i ] ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
write_byte( players[ i ] )
write_string( msg )
message_end()
}
}
}
}
Отредактировал: grishka444, - 21.8.2013, 19:10