AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   kill command blocked, how to kill player? (https://forums.alliedmods.net/showthread.php?t=3558)

karlos 07-09-2004 19:53

kill command blocked, how to kill player?
 
i am writing a plugin for natural-selection and i want to kill specific players. but when i use user_kill(id,0 or 1) or set_user_health(id,0), the player wont be killed immediatly but with a 3 second delay, the same as if i would type kill in console.
any1 know how i can kill without that delay??

AssKicR 07-09-2004 20:03

i think the only person here to know that whould be Cheesy

devicenull 07-09-2004 20:07

take_damage
Or...
Create an entity that does damage on them, wait a second, then remove it

Bad HAL 9000 07-09-2004 20:09

yar! I know it also. I had the same problem. You need to use takedamage

karlos 07-10-2004 04:02

k thx but how do i use it?
i tried this but not working entity_set_float(id, EV_FL_takedamage, damage) ?
also tried RadiusDamage(Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier) but do not enething neihter

Bad HAL 9000 07-10-2004 05:18

oh crap :-\ I could have sworn that they would have added the takedamage native from the NS module back in the day.

crap :(

What the hell bail! Get that in there!

CheesyPeteza 07-10-2004 08:26

Heh that reminds me, better fix slay for NS. :D

Heres code from ns2amx, pretty straight forward to convert it for the engine module.

Code:
stock fakedamage(idvictim,szClassname[],Float:takedmgdamage,damagetype) {     new entity = createentity("trigger_hurt")     if (entity)     {         set_keyvalue(entity,"classname","trigger_hurt")         new szDamage[16]         // Takedamages only do half damage per attack (damage is damage per second, and it's triggered in 0.5 second intervals).         // Compensate for that.         format(szDamage,15,"%f",takedmgdamage * 2)         set_keyvalue(entity,"dmg",szDamage)         format(szDamage,15,"%i",damagetype)         set_keyvalue(entity,"damagetype",szDamage)         set_keyvalue(entity,"origin","8192 8192 8192")         mdll_spawn(entity)         set_pev(entity,pev_classname,make_string(szClassname))         mdll_touch(idvictim,entity)         remove_entity(entity)         return 1     }     return 0 }

karlos 07-10-2004 09:31

for me its not straight forward to convert it for the engine module, i replaced (i hope its correct)
createentity() with create_entity()
set_keyvalue() with DispatchKeyValue()
mdll_touch() with fake_touch()

but i dont know what to do with
mdll_spawn(entity)
and
set_pev(entity,pev_classname,make_string(szCl assname))
(maybe entity_set_string() )

CheesyPeteza 07-10-2004 10:43

What you have done is correct.
mdll_spawn is just DispatchSpawn()
yes entity_set_string() is what you should use.

karlos 07-10-2004 12:26

ok i've done this:
Code:
#include <ns2amxdefines>  // cause of pev_classname stock fakedamage(idvictim,szClassname[],Float:takedmgdamage,damagetype) {     new entity = create_entity("trigger_hurt")     if (entity)     {         DispatchKeyValue(entity,"classname","trigger_hurt")         new szDamage[16]         // Takedamages only do half damage per attack (damage is damage per second, and it's triggered in 0.5 second intervals).         // Compensate for that.         format(szDamage,15,"%f",takedmgdamage * 2)         DispatchKeyValue(entity,"dmg",szDamage)         format(szDamage,15,"%i",damagetype)         DispatchKeyValue(entity,"damagetype",szDamage)         DispatchKeyValue(entity,"origin","8192 8192 8192")         DispatchSpawn(entity)         entity_set_string(entity,pev_classname,szClassname) //old was entity_set_string(entity,pev_classname,make_string(szClassname))         fake_touch(idvictim,entity)         remove_entity(entity)         return 1     }     return 0 }
and i call this with
Code:
fakedamage(id,"classname",1000.0,0)
and it's still not working, also i have another prob , when i use set_user_maxspeed(id,value) nothing happens, tried to set sv_maxspeed to 1000 too


All times are GMT -4. The time now is 14:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.