AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Radius_Damage (https://forums.alliedmods.net/showthread.php?t=50666)

Blue One 01-31-2007 15:23

Radius_Damage
 
hey guys i got some problems with my script , i dont know how i can configurate my Radiusdamage . I want that if i kill an Enemy that an little Explosion comes out of him . but nothing i dont know how i configurate the Radius Damage

Can anyone show me an example

with Player die public ? Please help me

godlike 01-31-2007 15:31

Re: Radius_Damage
 
I really dont know how to script but try to look in the source of warcraft3 the suicede bomber thingy.

dutchmeat 01-31-2007 16:37

Re: Radius_Damage
 
Code:

public radiusdamage(id){
new origin[3]
new damage = 50 //50 hp damage
new radius = 100 //radius is within 100 units
get_user_origin(id,origin)
radius_damage(origin,75,35)
}

Note that if it kills a person then the kill will show as suicide.
So the function i would use is this:
Code:
public radiusdamage(id){ new pnum = get_playersnum() for(new a = 1; a <= pnum; a++) { if(userinradius(a,id)){ console_print(a,"you are in the radius!") } } } public userinradius(a,id){ new distanceBetween new origin1[3], origin[3] new dmgRadius = 100 get_user_origin(id, origin) if ( is_user_alive(a) && a != id) { get_user_origin(a, origin1) distanceBetween = get_distance(origin, origin1) if ( distanceBetween < dmgRadius ) { return 1 } } return 0 }

This way, you can determine your own deathmessage.

Greenberet 01-31-2007 17:34

Re: Radius_Damage
 
well i wrote a dynamic native for my plugins long time ago.
Code:
//... somewhere in your *.inc file native radiusDamage( Entity, DeathMsg[], Float:MaxDamage, Float:MaxRadius, Float:MaxDamageRadius, IgnoreEntity = 0 ); //... public plugin_natives() register_native( "radiusDamage"                , "__RadiusDamage" ); //... somewhere in your code public __RadiusDamage( Plugin ) {     static iEntity;     iEntity = get_param(1);         static Classname[64];     get_string( 2, Classname, 63 );         static Float:fMaxDamage;     fMaxDamage = get_param_f( 3 );         static Float:MaxRadius;     MaxRadius = get_param_f( 4 );         static Float:iRadius;     iRadius = get_param_f( 5 );         static IgnoreEntity;     IgnoreEntity = get_param(6);         static Float:vExplodeAt[3], Float:damage, Float:origin1[3];     pev(iEntity, pev_origin, vExplodeAt);         static Float:multiplier, Float:distanceBetween;     static maxClients;     maxClients = global_get( glb_maxClients );         static Float:hp;                         new owner = pev(iEntity, pev_owner );     iEntity = owner ? owner : iEntity;         for(new id = 1; id <= maxClients ; id++)     {         if( pev_valid(id)          && is_user_alive(id)          && IgnoreEntity != id          && ( get_pcvar_num( CVAR_FriendlyFire ) || getClientTEAM( iEntity ) != getClientTEAM( id ) )           )         {             pev(id, pev_origin, origin1);             distanceBetween = get_distance_f(vExplodeAt, origin1 );                         if( distanceBetween <= MaxRadius )             {                 multiplier = ( fMaxDamage * fMaxDamage ) / iRadius;                 damage = ( iRadius - distanceBetween ) * multiplier;                 damage = floatsqroot( damage );                 pev( id, pev_health, hp );                 hp -= damage;                 if( hp <= 0 )                 {                     silentClientKILL( id );                     message_begin    ( MSG_ALL, MSG_DeathMsg, { 0, 0, 0 }, 0 );                     write_byte    ( iEntity );                     write_byte    ( id );                     write_string    ( Classname );                     message_end    ();                 }                 else                 {                     set_pev( id, pev_health, hp );                     message_begin    ( MSG_ONE, MSG_Health, {0,0,0} , id );                     write_byte    ( floatround(hp) );                     message_end    ();                 }                                 }         }     }     }

iEntity = Entity who does damage. If it has an owner, the owner will be used for the DeathMsg
DeathMsg = The weapon that will be displayed
MaxDamage = the max damage that a client will get
MaxRadius = Inside of this radius the client will get damage. How much depends on the distance to the explosion core
MaxDamageRadius = If a player is inside of this radius the client will get the maxdamage
IgnoreEntity = this entity will not get any damage.

NOTE: This code contains functions that are not in included in amxx. So you have to port this function first b4 you can use it.

getClientTEAM = returns TeamID of the player
silentClientKILL = kills a player without score-/deathmessages


All times are GMT -4. The time now is 00:38.

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