Wgraj ten kod, wpisz w chat /reka i sprawdź wiadomość, zrób tak przy cl_righthand 0 i 1, przy 0 wiadomość będzie o Lewej Ręce, przy 1 będzie o Prawej Ręce.
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#define PLUGIN "Left-Hand Knife"
#define VERSION "1.0"
#define AUTHOR "oeN."
new bool:rightHand[33];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /reka", "Reka");
new classname[32]
for(new i=1;i<31;++i) {
if(i!=2) {
get_weaponname(i,classname,31)
RegisterHam(Ham_Item_Deploy, classname, "fwItemDeploy",1);
}
}
}
public client_authorized(id)
set_task(1.0, "CheckHand", id);
public CheckHand(id) {
set_task(1.0, "CheckHand", id);
if(!is_user_connected(id) || is_user_bot(id))
return PLUGIN_CONTINUE;
query_client_cvar(id,"cl_righthand","PlayerHand");
return PLUGIN_CONTINUE;
}
public fwItemDeploy(wpn)
{
static id;
id = entity_get_edict(wpn, EV_ENT_owner)
new weapon = cs_get_weapon_id(wpn)
if(weapon == CSW_KNIFE && rightHand[id])
client_cmd(id, "cl_righthand ^"0^"");
else
client_cmd(id, "cl_righthand ^"1^"");
}
public PlayerHand(id,const cvar[],const value[]){
new Float:val=str_to_float(value);
if(val <= 0)
rightHand[id] = false
else
rightHand[id] = true
}
public Reka(id) {
rightHand[id] ? client_print(id, print_chat, "Uzywasz Prawej Reki") : client_print(id, print_chat, "Uzywasz Lewej Reki");
}