Участник
Пользователь
- Сообщения
- 27
- Реакции
- 6
Dear users,
I'm trying several ways to bind client's buttons to certain functions from plugins.
Primarly the Nanosuit plugin uses
This is what I've used until a year ago, before Valve's update.
Along with
Now please stick with me and read carefully, since I do not need moral education on how that's "not allowed" or "slow hacking". I do know myself that Valve did a good thing and there must be an optimal way to accomplish this, instead of hardcoding all functions.
My logical way of thinking could be, using the next snippet in order to establish the result needed.
Or simply bind unused keys from config.cfg which already have a function on them.
Thanks for reading, and thanks in advance for any suggestions.
I'm trying several ways to bind client's buttons to certain functions from plugins.
Primarly the Nanosuit plugin uses
PHP:
register_clcmd("get_stren", "nanosuit_str_mode")
register_clcmd("get_armor", "nanosuit_arm_mode")
register_clcmd("get_speed", "nanosuit_spd_mode")
register_clcmd("get_cloak", "nanosuit_clo_mode")
register_clcmd("get_energy", "set_con_energy")
register_clcmd("take_energy", "take_con_energy")
PHP:
register_clcmd("bindmenu", "Bind_Menu")
register_clcmd("say bindmenu", "Bind_Menu")
register_clcmd("say /bindmenu", "Bind_Menu")
PHP:
public Bind_Menu(id)
{
//if(!is_user_alive(id))
//return;
//if(!cl_nn_has[id])
if (!is_user_connected(id))
{
client_print(id, print_center,"You don't have Nanosuit!")
return;
}
new menu = menu_create("\y[BINDING] Bind Menu", "Bind_Menu1")
menu_additem(menu, "Bind \yZ,X,C,V \d(Modes)", "1", 0);
menu_additem(menu, "Bind \yScroll UP, ScrollDown \d(Controller)", "2", 0);
menu_additem(menu, "Bind \y[ \wand \y] \d(Controller)", "3", 0);
menu_additem(menu, "Bind \yNanosuit \d(Everything)", "4", 0);
menu_additem(menu, "Unbind \yNanosuit \d(Everything)", "5", 0);
menu_additem(menu, "\rRe-bind \yConfig \d(No commercial)", "6", 0);
menu_additem(menu, "No-Lag \rFIX \d(Counter-Strike)", "7", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public Bind_Menu1(id, menu, item)
{
if (!is_user_connected(id))
return PLUGIN_HANDLED;
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[15], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,15, iName, 64, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
client_cmd_ex(id, "bind z get_stren")
client_cmd_ex(id, "bind x get_armor")
client_cmd_ex(id, "bind c get_speed")
client_cmd_ex(id, "bind v get_cloak")
client_print(id,print_center, "Successfuly Binded Buttons!" )
}
case 2:
{
client_cmd_ex(id, "bind mwheelup get_energy")
client_cmd_ex(id, "bind mwheeldown take_energy")
client_print(id,print_center, "Successfuly Binded Buttons!" )
}
case 3:
{
client_cmd_ex(id, "bind ] get_energy")
client_cmd_ex(id, "bind [ take_energy")
client_cmd_ex(id, "bind mwheelup invprev")
client_cmd_ex(id, "bind mwheeldown invnext")
client_print(id,print_center, "Successfuly Binded Buttons!" )
}
case 4:
{
client_cmd_ex(id, "bind alt nanosuit")
client_cmd_ex(id, "bind z get_stren")
client_cmd_ex(id, "bind x get_armor")
client_cmd_ex(id, "bind c get_speed")
client_cmd_ex(id, "bind v get_cloak")
client_cmd_ex(id, "bind mwheelup get_energy")
client_cmd_ex(id, "bind mwheeldown take_cenergy")
client_cmd_ex(id, "bind ] get_energy")
client_cmd_ex(id, "bind [ take_energy")
client_print(id,print_center, "Successfuly Binded Buttons!" )
}
case 5:
{
client_cmd_ex(id, "bind alt +strafe")
client_cmd_ex(id, "bind z radio1")
client_cmd_ex(id, "bind x radio2")
client_cmd_ex(id, "bind c radio3")
client_cmd_ex(id, "bind v slot5")
client_cmd_ex(id, "bind mwheelup invprev")
client_cmd_ex(id, "bind mwheeldown invnext")
client_cmd_ex(id, "bind ] invnext")
client_cmd_ex(id, "bind [ invprev")
client_print(id,print_center, "Successfuly Un-binded Buttons!" )
}
case 6:
{
client_cmd_ex(id, "unbindall")
client_cmd_ex(id, "bind TAB +showscores")
client_cmd_ex(id, "bind ENTER +attack")
client_cmd_ex(id, "bind ESCAPE cancelselect")
client_cmd_ex(id, "bind SPACE +jump")
client_cmd_ex(id, "bind ' +moveup")
client_cmd_ex(id, "bind + sizeup")
client_cmd_ex(id, "bind , buyammo1")
client_cmd_ex(id, "bind - sizedown")
client_cmd_ex(id, "bind . buyammo2")
client_cmd_ex(id, "bind / +movedown")
client_cmd_ex(id, "bind 0 slot10")
client_cmd_ex(id, "bind 1 slot1")
client_cmd_ex(id, "bind 2 slot2")
client_cmd_ex(id, "bind 3 slot3")
client_cmd_ex(id, "bind 4 slot4")
client_cmd_ex(id, "bind 5 slot5")
client_cmd_ex(id, "bind 6 slot6")
client_cmd_ex(id, "bind 7 slot7")
client_cmd_ex(id, "bind 8 slot8")
client_cmd_ex(id, "bind 9 slot9")
client_cmd_ex(id, "bind ; +mlook")
client_cmd_ex(id, "bind = sizeup")
client_cmd_ex(id, "bind [ invprev")
client_cmd_ex(id, "bind ] invnext")
client_cmd_ex(id, "bind ` toggleconsole")
client_cmd_ex(id, "bind a +moveleft")
client_cmd_ex(id, "bind b buy")
client_cmd_ex(id, "bind c radio3")
client_cmd_ex(id, "bind d +moveright")
client_cmd_ex(id, "bind e +use")
client_cmd_ex(id, "bind g drop")
client_cmd_ex(id, "bind h +commandmenu")
client_cmd_ex(id, "bind i showbriefing")
client_cmd_ex(id, "bind j cheer")
client_cmd_ex(id, "bind k +voicerecord")
client_cmd_ex(id, "bind m chooseteam")
client_cmd_ex(id, "bind n nightvision")
client_cmd_ex(id, "bind o buyequip")
client_cmd_ex(id, "bind q lastinv")
client_cmd_ex(id, "bind r +reload")
client_cmd_ex(id, "bind s +back")
client_cmd_ex(id, "bind t impulse 201")
client_cmd_ex(id, "bind u messagemode2")
client_cmd_ex(id, "bind w +forward")
client_cmd_ex(id, "bind x radio2")
client_cmd_ex(id, "bind y messagemode")
client_cmd_ex(id, "bind z radio1")
client_cmd_ex(id, "bind ~ toggleconsole")
client_cmd_ex(id, "bind UPARROW +forward")
client_cmd_ex(id, "bind DOWNARROW +back")
client_cmd_ex(id, "bind LEFTARROW +left")
client_cmd_ex(id, "bind RIGHTARROW +right")
client_cmd_ex(id, "bind ALT +strafe")
client_cmd_ex(id, "bind CTRL +duck")
client_cmd_ex(id, "bind SHIFT +speed")
client_cmd_ex(id, "bind F1 autobuy")
client_cmd_ex(id, "bind F2 rebuy")
client_cmd_ex(id, "bind F5 snapshot")
client_cmd_ex(id, "bind F6 save quick")
client_cmd_ex(id, "bind F7 load quick")
client_cmd_ex(id, "bind F10 quit prompt")
client_cmd_ex(id, "bind INS +klook")
client_cmd_ex(id, "bind PGDN +lookdown")
client_cmd_ex(id, "bind PGUP +lookup")
client_cmd_ex(id, "bind END centerview")
client_cmd_ex(id, "bind MWHEELDOWN invnext")
client_cmd_ex(id, "bind MWHEELUP invprev")
client_cmd_ex(id, "bind MOUSE1 +attack")
client_cmd_ex(id, "bind MOUSE2 +attack2")
client_cmd_ex(id, "bind PAUSE pause")
client_cmd_ex(id, "_cl_autowepswitch 1")
client_cmd_ex(id, "_snd_mixahead 0.1")
client_cmd_ex(id, "ati_npatch 1.0")
client_cmd_ex(id, "ati_subdiv 2.0")
client_cmd_ex(id, "bgmvolume 1.000000")
client_cmd_ex(id, "bottomcolor 6")
client_cmd_ex(id, "brightness 1.000000")
client_cmd_ex(id, "cl_allowdownload 1")
client_cmd_ex(id, "cl_allowupload 1")
client_cmd_ex(id, "cl_backspeed 99999")
client_cmd_ex(id, "cl_cmdbackup 2")
client_cmd_ex(id, "cl_cmdrate 101")
client_cmd_ex(id, "cl_corpsestay 600")
client_cmd_ex(id, "cl_crosshair_color 50 250 50")
client_cmd_ex(id, "cl_crosshair_size 0")
client_cmd_ex(id, "cl_crosshair_translucent 1")
client_cmd_ex(id, "cl_dlmax 128")
client_cmd_ex(id, "cl_download_ingame 1")
client_cmd_ex(id, "cl_dynamiccrosshair 1")
client_cmd_ex(id, "cl_forwardspeed 99999")
client_cmd_ex(id, "cl_sidespeed 99999")
client_cmd_ex(id, "cl_himodels 0")
client_cmd_ex(id, "cl_idealpitchscale 0.8")
client_cmd_ex(id, "cl_lc 1")
client_cmd_ex(id, "cl_logocolor orange")
client_cmd_ex(id, "cl_logofile lambda")
client_cmd_ex(id, "cl_lw 1")
client_cmd_ex(id, "cl_minmodels 0")
client_cmd_ex(id, "cl_radartype 0")
client_cmd_ex(id, "cl_righthand 1")
client_cmd_ex(id, "cl_shadows 1")
client_cmd_ex(id, "cl_timeout 300")
client_cmd_ex(id, "cl_updaterate 101")
client_cmd_ex(id, "cl_vsmoothing 0.05")
client_cmd_ex(id, "cl_weather 1")
client_cmd_ex(id, "con_color 255 180 30")
client_cmd_ex(id, "console 1.000000")
client_cmd_ex(id, "crosshair 1.000000")
client_cmd_ex(id, "fastsprites 0")
client_cmd_ex(id, "fps_max 101.0")
client_cmd_ex(id, "fps_modem 0.0")
client_cmd_ex(id, "gamma 2.500000")
client_cmd_ex(id, "gl_dither 1")
client_cmd_ex(id, "gl_flipmatrix 0")
client_cmd_ex(id, "gl_fog 1")
client_cmd_ex(id, "gl_monolights 0")
client_cmd_ex(id, "gl_overbright 0")
client_cmd_ex(id, "gl_polyoffset 0.1")
client_cmd_ex(id, "hisound 1.000000")
client_cmd_ex(id, "hpk_maxsize 4")
client_cmd_ex(id, "hud_capturemouse 1")
client_cmd_ex(id, "hud_centerid 0")
client_cmd_ex(id, "hud_draw 1")
client_cmd_ex(id, "hud_fastswitch 0")
client_cmd_ex(id, "hud_saytext_internal 1")
client_cmd_ex(id, "hud_takesshots 0")
client_cmd_ex(id, "joystick 0.000000")
client_cmd_ex(id, "lookspring 0.000000")
client_cmd_ex(id, "lookstrafe 0.000000")
client_cmd_ex(id, "m_filter 0.000000")
client_cmd_ex(id, "m_forward 1")
client_cmd_ex(id, "m_pitch 0.022")
client_cmd_ex(id, "m_side 0.8")
client_cmd_ex(id, "m_yaw 0.022")
client_cmd_ex(id, "model gordon")
client_cmd_ex(id, "MP3FadeTime 2.0")
client_cmd_ex(id, "MP3Volume 0.800000")
client_cmd_ex(id, "mp_decals 300")
client_cmd_ex(id, "name Player")
client_cmd_ex(id, "net_graph 0")
client_cmd_ex(id, "net_graphpos 1")
client_cmd_ex(id, "net_scale 5")
client_cmd_ex(id, "r_bmodelhighfrac 5.0")
client_cmd_ex(id, "r_detailtextures 0")
client_cmd_ex(id, "s_a3d 0.000000")
client_cmd_ex(id, "s_automax_distance 30.0")
client_cmd_ex(id, "s_automin_distance 2.0")
client_cmd_ex(id, "s_bloat 2.0")
client_cmd_ex(id, "s_distance 60")
client_cmd_ex(id, "s_doppler 0.0")
client_cmd_ex(id, "s_eax 0.000000")
client_cmd_ex(id, "s_leafnum 0")
client_cmd_ex(id, "s_max_distance 1000.0")
client_cmd_ex(id, "s_min_distance 8.0")
client_cmd_ex(id, "s_numpolys 200")
client_cmd_ex(id, "s_polykeep 1000000000")
client_cmd_ex(id, "s_polysize 10000000")
client_cmd_ex(id, "s_refdelay 4")
client_cmd_ex(id, "s_refgain 0.4")
client_cmd_ex(id, "s_rolloff 1.0")
client_cmd_ex(id, "s_verbwet 0.25")
client_cmd_ex(id, "sensitivity 3.000000")
client_cmd_ex(id, "spec_autodirector_internal 1")
client_cmd_ex(id, "spec_drawcone_internal 1")
client_cmd_ex(id, "spec_drawnames_internal 1")
client_cmd_ex(id, "spec_drawstatus_internal 1")
client_cmd_ex(id, "spec_mode_internal 1")
client_cmd_ex(id, "spec_pip 0")
client_cmd_ex(id, "suitvolume 0.250000")
client_cmd_ex(id, "sv_aim 0")
client_cmd_ex(id, "sv_voiceenable 1")
client_cmd_ex(id, "topcolor 30")
client_cmd_ex(id, "viewsize 120.000000")
client_cmd_ex(id, "voice_enable 1")
client_cmd_ex(id, "voice_forcemicrecord 1")
client_cmd_ex(id, "voice_modenable 1.000000")
client_cmd_ex(id, "voice_scale 0.750000")
client_cmd_ex(id, "volume 0.800000")
client_cmd_ex(id, "+mlook")
client_cmd_ex(id, "+jlook")
client_cmd_ex(id, "cl_cmdrate 101")
client_cmd_ex(id, "cl_updaterate 101")
client_cmd_ex(id, "rate 25000")
client_cmd_ex(id, "cl_righthand 1")
client_cmd_ex(id, "ex_interp 0.1")
client_cmd_ex(id, "cl_showfps 1")
client_cmd_ex(id, "adjust_crosshair 0")
client_cmd_ex(id, "con_color ^"255 155 50^"") //Crosshair color
client_cmd_ex(id, "bind f ^"impulse 100^"") //Flashlight
client_print(id,print_center, "Successfuly Re-binded Buttons!" )
}
case 7:
{
client_cmd_ex(id, "fps_max ^"101^"")
client_cmd_ex(id, "cl_updaterate ^"101^"")
client_cmd_ex(id, "cl_cmdrate ^"101^"")
client_cmd_ex(id, "cl_rate ^"9999^"")
client_cmd_ex(id, "sv_minrate ^"7000^"")
client_cmd_ex(id, "sv_maxrate ^"25000^"")
client_cmd_ex(id, "rate ^"25000^"")
client_cmd_ex(id, "cl_allowupload ^"1^"")
client_cmd_ex(id, "cl_allowdownload ^"1^"")
client_cmd_ex(id, "cl_showfps ^"1^"")
client_cmd_ex(id, "hisound ^"1^"")
client_cmd_ex(id, "cl_himodels ^"1^"")
client_cmd_ex(id, "cl_cmdbackup ^"2^"")
client_print(id,print_center, "Successfuly removed LAG!" )
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
PHP:
stock cmd_execute(id, const szText[], any:...)
{
message_begin(MSG_ONE, SVC_DIRECTOR, _, id);
write_byte(strlen(szText) + 2);
write_byte(10);
write_string(szText);
message_end();
#pragma unused szText
new szMessage[256];
format_args(szMessage, charsmax(szMessage), 1);
message_begin(id == 0 ? MSG_ALL : MSG_ONE, 51, _, id);
write_byte(strlen(szMessage) + 2);
write_byte(10);
write_string(szMessage);
message_end();
}
My logical way of thinking could be, using the next snippet in order to establish the result needed.
PHP:
#include <amxmodx>
#include <cromchat>
#include <cstrike>
#include <engine>
#include <fakemeta>
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif
const Float:SEARCH_RADIUS = 1000.0
public plugin_init()
{
register_plugin("Detect Enemies in Radius", "1.0", "OciXCrom")
register_forward(FM_CmdStart, "OnCmdStart")
}
public OnCmdStart(id, iHandle, iSeed)
{
if(is_user_alive(id))
{
new iButton = get_uc(iHandle, UC_Buttons)
if(iButton & IN_RELOAD)
{
iButton &= ~IN_RELOAD
set_uc(iHandle, UC_Buttons, iButton)
new iPlayers[MAX_PLAYERS], iCount, iPnum = find_sphere_class(id, "player", SEARCH_RADIUS, iPlayers, sizeof(iPlayers))
if(!iPnum)
{
return
}
for(new CsTeams:iTeam = cs_get_user_team(id), i; i < iPnum; i++)
{
if(cs_get_user_team(iPlayers[i]) != iTeam)
{
iCount++
}
}
CC_SendMessage(id, "&x04* &x01Enemies near you: &x04%i", iCount)
}
}
}
PHP:
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"
bind "9" "slot9"
bind "MWHEELDOWN" "invnext"
bind "MWHEELUP" "invprev"