New Member
08-25-2019
, 09:04
Repeat function, through verification
#1
Hi, not how can not understand how to do.
what I need
You need to replace "headtouch_delay" with a check to see if "iToucher stood on the ground before touching iTouched", in which case the function is executed
Sorry for bad english
CODE
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);
register_touch("player", "player", "iTouchPlayer");
g_pDelay = register_cvar("headtouch_delay", "1.0");
g_pDamage = register_cvar("headtouch_damage", "0.0");
}
public plugin_precache() {
precache_sound(g_pHeadTouch0);
}
public iTouchPlayer(iToucher, iTouched)
{
if(entity_get_int(iToucher, EV_INT_flags) & FL_ONGROUND && entity_get_edict(iToucher, EV_ENT_groundentity) == iTouched && cs_get_user_team(iToucher) == CS_TEAM_T && cs_get_user_team(iTouched) == CS_TEAM_CT ) {
static Float: flGametime;
flGametime = get_gametime();
if(flGametime > (g_flLastHeadTouch[iToucher] + get_pcvar_float(g_pDelay)) ) {
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;
emit_sound(0, CHAN_STREAM, g_pHeadTouch0, 0.7, ATTN_NORM, 0, PITCH_NORM);
client_cmd(0, "spk %s", g_pHeadTouch0);
}
return PLUGIN_HANDLED
}
}
Thank you in advance