AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Would something like this work? (https://forums.alliedmods.net/showthread.php?t=107745)

Doc-Holiday 10-29-2009 19:50

Would something like this work?
 
What i want this to do is
Check for the attacker/victim is alive
if they are enemies
and if the knife was used
Damage * pcvar


Code:
public PlayerHurt( victim, inflictor, attacker, Float:damage, damagebits )// Not sure on the last one {         new szWeapon[20];     szWeapon = get_user_weapon2(id);         if( equal (szWeapon, "knife") )     {         if(is_user_alive( victim ) && is_user_alive( attacker ) )         {                     if(cs_get_user_team( victim ) != cs_get_user_team( attacker ) )             {                 SetHamParamFloat(4, damage * get_pcvar_float(dmg_multi));             }         }     } } public get_user_weapon2( id ) {     new szWeapon[ 20 ];     get_weaponname( get_user_weapon( id ), szWeapon, charsmax( szWeapon ) );         return szWeapon[7]; }

VMAN 10-29-2009 23:28

Re: Would something like this work?
 
try it

Doc-Holiday 10-29-2009 23:50

Re: Would something like this work?
 
Quote:

Originally Posted by VMAN (Post 975745)
try it


im not at home cant test......

on my laptop via sprint mobile

Exolent[jNr] 10-29-2009 23:59

Re: Would something like this work?
 
Code:
#include < amxmodx > #include < hamsandwich > new pCvarDamageMult; new g_iMaxPlayers; public plugin_init( ) {     RegisterHam( Ham_TakeDamage, "player", "FwdPlayerDamage" );         pCvarDamageMult = register_cvar( "knife_damage_mult", "2.0" );         g_iMaxPlayers = get_maxplayers( ); } public FwdPlayerDamage( iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits ) {     if( ( 1 <= iAttacker <= g_iMaxPlayers )     && iAttacker != iVictim     && iAttacker == iInflictor     && get_user_weapon( iAttacker ) == CSW_KNIFE ) {         SetHamParamFloat( 4, ( fDamage * get_pcvar_float( pCvarDamageMult ) ) );     } }


All times are GMT -4. The time now is 17:48.

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