I have a small mod that I use to play around with botters who come on the server. One of the functions kills the client whenever they kill someone. Initially, I planned to bring their victim back to life but the simple method of trying to set their health back to positive doesn't work properly. Any suggestions?
--on a player death, check to see if the killer is flagged up for ownage
function et_Obituary( victim, killer, meansOfDeath )
-- if the killer is flagged for ownage, then own the bastard
if own_client[killer] == 1 then
-- explanation - et.G_Damage( target, inflictor, attacker, damage, dflags, mod ), mod 0 = unknown
et.G_Damage( killer, 80, victim, 1000, 8, meansOfDeath )
-- bring the victim back to life here
-- note: this doesn't work very well; victim seems to be "dead" hence another kill doesnt register
-- et.gentity_set(victim, "health", 100)
end
end
I don't know where it is in the code, but I remember some warning rain wrote in the oasis script about the "revive box being called" maybe you should look at "reviving" them.
Yes, this is more accurately what I'm asking for. By using the code that's commented out above, I can bring an ungibbed person back to life but it has repercussions. They dont seem to be 'officially' alive so funny things happen when they kill people or get killed again.
Nappy wrote:I believe you need something that will trigger et_ClientSpawn( clientNum, revived ).
Correct. There is a lot more to the revive code than just adding the health. You can't currently do it from lua.
You could try using the revive server console command, but that requires cheats be enabled. You might be able to twiddle sv_cheats quickly while you send the revive command, I suppose. I suspect this would end up being more of a kludge than you want.
yea i fiddled with a playdead command for KMOD. The player would fall down normally but when you stood back up and started running round you still appeared injured/limbo waiting for a revive. To see a person wanting to be revived jumping around and running and shooting was really funny. After you stand back up you can't hear your footsteps either unless you jump.
I did a version using a sv_cheats switch and a console command to revive the player. It works, but it has the same problems as simply setting the player's health, i.e. sometimes the revived player's kills and next death dont register.
Too much of a push for lua I reckon, will happily post up what I had if anyone is interested.
McSteve wrote:I did a version using a sv_cheats switch and a console command to revive the player. It works, but it has the same problems as simply setting the player's health, i.e. sometimes the revived player's kills and next death dont register.
Too much of a push for lua I reckon, will happily post up what I had if anyone is interested.
You used the 'revive <playername>' server console command ? This should work almost exactly like getting hit with a needle (except that the players being revived is also counted as the reviver, for things like whether they get a full revive or not)
It won't work quite right if the player is already gibbed. Also note that 'revive' takes a player name, matching an exact (less color codes) name first, or failing that, a partial match.
Hmm, I would have to go back and double-check, but I'm reasonably certain I got strange behaviour even if reviving an ungibbed player.
Its not a big issue anyway, it was only a niceity to polish off that script. You've made me curious now though, I might go back and have another look at the different cases.