Quote:
Originally Posted by Natsheh
Here you can use this hook to strip the 3 frags given to the defuser
PHP Code:
register_logevent("logevent_defuse", 3, "2=Defused_The_Bomb")
public logevent_defuse()
{
new id = ........ The defuser id from the log.
set_user_frags(id, get_user_frags(id) - 3)
}
}
And the same thing for the planter...
|
and the defuser of the log is?, does not exist
you can hook the event, the act, but not get the one that put it like that, you have to look for the classname of the c4 which is "weapon_c4", from there get the owner, (assuming that the owner of the c4 is the one who planted it)
"new id = ........ The defuser id from the log."
It makes me laugh when they put these things in the middle when they don't even know
here you have a real guide, the logevent is only a hook of when something in particular happens, but it does not leave you any other tool
https://forums.alliedmods.net/showthread.php?t=40164
IMPORTANT Edit: if you just want to get the index of the planted and the defused, better hook the sound/voice, when someone defuses or plants, the player says a phrase, "the bomb has been planted", "the bomb was defused" , there you get the exact moment and index(I don't know if it works, it's just an idea, but you can follow the guide above if it doesn't work)
PHP Code:
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_EmitSound , "EmitSound");
}
public EmitSound(id, channel, const sound[])
{
if(equal(sound , "weapons/planted.wav")) // i dont know the real name sound
{
// The bomb has been planted
set_user_frags(id, get_user_frags(id) + 3)
}
else if(equal(sound, "weapons/defused.wav" ))
{
// the bomb has been defused
set_user_frags(id, get_user_frags(id) + 3)
}
}