atomic-penguin / sm-hidden

Hidden:Source like mod for TF2
GNU General Public License v3.0
2 stars 2 forks source link

Hidden gets first blood crits #13

Closed ghost closed 11 years ago

ghost commented 11 years ago

leaving this here:

function we should be targeting : public Action:player_death(Handle:event, const String:name[], bool:dontBroadcast)

/ new killer = GetClientOfUserId(GetEventInt(event, "attacker")); new cond = GetEntProp(killer, Prop_Send, "m_nPlayerCond"); SetEntProp(killer, Prop_Send, "m_nPlayerCond", cond & ~PLAYER_FIRSTBLOOD); / source http://forums.alliedmods.net/showthread.php?t=99147

ghost commented 11 years ago

https://github.com/daniel-murray/sm-hidden/commit/08bb49eb021c5846b664f244d65fd9cb35e6cda2

ghost commented 11 years ago

leaving this here:

https://forums.alliedmods.net/showthread.php?t=178055 http://docs.sourcemod.net/api/index.php?fastload=show&id=82& SetEntProp http://docs.sourcemod.net/api/index.php?fastload=show&id=81& GetEntProp http://wiki.alliedmods.net/Pawn_Tutorial#Expressions

thinking out loud here if this is really obvious please tell me!!

it seems like the above code is storing whatever the current play condition is as a number, then applying a bitwise add to the bitwise complement of PLAYER_FIRSTBlOOD (which is 1<<11), which will have the effect of removing the bit for firstblood if it's present. so suppose the GetEntProp returned 101101010101, performing cond & ~PLAYER_FIRSTBLOOD would be the same as 101101010101 & 011111111111 == 001101010101, so setting SetEntProp(killer, Prop_Send, "m_nPlayerCond", cond & ~PLAYER_FIRSTBLOOD); or SetEntProp(killer, Prop_Send, "m_nPlayerCond", 001101010101); will reset killer's condtion to be without the firstblood flag if it was present

ghost commented 11 years ago

if this is the case any #define with the value (1<<11) should work, however it makes sense to define PLAYER_FIRSTBLOOD separately.

ghost commented 11 years ago

so player_death might look like this https://gist.github.com/5ac95e190977c1331ff6

atomic-penguin commented 11 years ago

We set tf_arena_first_blood 0 in ActivatePlugin, should no longer be an issue.