PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>
#define PLUGIN "-"
#define VERSION "1.0"
#define AUTHOR "-"
#pragma semicolon 1
new Float: g_flLastHeadTouch[33], g_pDelay, g_pDamage;
new const g_pHeadTouch0[] = "misc/risamalo.wav";
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
g_pDelay = register_cvar("headtouch_delay", "1.0");
g_pDamage = register_cvar("headtouch_damage", "0.0");
register_touch("player", "*", "PlayerTouches");
}
public PlayerTouches(iToucher, iTouched)
{
static pLastTouch[33] = {0, ...};
if(!is_user_alive(entity_get_edict(iToucher, EV_ENT_groundentity))) { pLastTouch[iToucher] = iTouched; return; }
if(entity_get_edict(iToucher, EV_ENT_groundentity) == iTouched ) {
static Float: flGametime;
flGametime = get_gametime();
if( !(1 <= pLastTouch[iToucher] <= 32)) {
// your code for touching player head when last stand was on ground(worldspawn, brush entity, other non player entitys)
}
if(flGametime > g_flLastHeadTouch[iToucher] && cs_get_user_team(iToucher) == CS_TEAM_T && cs_get_user_team(iTouched) == CS_TEAM_CT) {
new szAttackerName[64],
szTouchedName[64];
get_user_name(iToucher, szAttackerName, charsmax(szAttackerName));
get_user_name(iTouched, szTouchedName, charsmax(szTouchedName));
fakedamage(iTouched, szAttackerName, get_pcvar_float(g_pDamage), DMG_CRUSH);
set_hudmessage(255, 85, 255, -1.0, 0.20, 0, 6.0, 12.0);
show_hudmessage(0, "[TEST] %s hahaha %s !", szAttackerName, szTouchedName);
g_flLastHeadTouch[iToucher] = flGametime + get_pcvar_float(g_pDelay);
emit_sound(0, CHAN_STREAM, g_pHeadTouch0, 0.7, ATTN_NORM, 0, PITCH_NORM);
client_cmd(0, "spk %s", g_pHeadTouch0);
}
pLastTouch[iToucher] = iTouched;
}
}
PS : IF YOUR ENGLISH IS SO BAD WHY DON'T You ASK FOR SUPPORT ON RUSSIAN FORUMS.
__________________