View Full Version : do you have what im looking for?
i need to know how to write a script:
that gives me a score if i hit some one in the head.
#include <amxmodx>
public plugin_init()
{
register_event("DeathMsg", "Event_DeathMsg", "a", "1!0", "2!0");
}
public Event_DeathMsg()
{
if(!is_user_connected(read_data(2)) || !is_user_alive(read_data(1))
return PLUGIN_CONTINUE;
if(read_data(3))
{
// headshot
}
return PLUGIN_CONTINUE;
}
thank you.
if you are still alive, after i shot you in the head?
just want that if i shoot you in the head i get 1 score,
even if you have godmode.
Exolent[jNr]
05-01-2008, 21:50
#include <amxmodx>
#include <fakemeta>
public plugin_init()
{
register_forward(FM_TraceLine, "fwd_FM_TraceLine");
}
public fwd_FM_TraceLine(Float:vStart[3], Float:vEnd[3], iNoMonsters, index, trace)
{
if(is_user_alive(index) && is_user_alive(get_tr2(trace, TR_pHit)) && get_tr2(trace, TR_iHitgroup) == HIT_HEAD)
{
static Float:fFrags;
pev(index, pev_frags, fFrags);
set_pev(index, pev_frags ++fFrags);
}
return FMRES_IGNORED;
}
Note: the above method will increment player's frags even without any shots at all. Read my corresponding thread in the tutorials section for details.
Exolent[jNr]
05-03-2008, 13:25
I only thought FM_TraceLine was only called on shots :O
Well, I learned something :)
I'll implement your tutorial in a few minutes.
YamiKaitou
05-03-2008, 19:47
Use descriptive topic titles. People should know at a glance of the title what the thread is about.http://forums.alliedmods.net/showthread.php?t=49470
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.