AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Individual friendly fire (https://forums.alliedmods.net/showthread.php?t=117590)

benamo6 02-02-2010 18:03

Individual friendly fire
 
How can I make that a player can recieve damage and make damage to teammates, I mean like only that player have friendly fire on?
Example:
Player A and B are terrorists
Player A say /hitme
By typing /hitme individual friendly fire is enabled on player A
Player B can damage player A, and viceversa.

Ive tried with this, but it isnt working:
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new Masoquista[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /maso""masoquista")
    
    
RegisterHam(Ham_Spawn,         "player""Fwd_PlayerSpawn_Post",    1)
    
RegisterHam(Ham_TakeDamage,     "player""FwdTakeDamage",         0)
}

public 
masoquista(id)
{
    if(
get_user_team(id) == 1)
        
Masoquista[id] = 1
}

public 
Fwd_PlayerSpawn_Post(id)
{
    
Masoquista[id] = 0
}

public 
FwdTakeDamage(victiminflictorattackerFloat:damagedamage_bits)
{
    if(!
Masoquista[attacker] && Masoquista[victim])
    {
        new 
Float:Health
        pev
(victimpev_healthHealth)
        
set_pev(victimpev_healthHealth damage)  
    }



OM NOM NOM NOM 02-02-2010 18:25

Re: Individual friendly fire
 
I love the idea.

Bugsy 02-02-2010 18:26

Re: Individual friendly fire
 
untested
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new bool:Masoquista33 ]
new 
g_iMaxPlayers;

#define IsPlayer(%1)    (1<=%1<=g_iMaxPlayers)

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd"say /maso" "masoquista" )
    
    
g_iMaxPlayers get_maxplayers();
    
    
RegisterHamHam_Spawn "player" "Fwd_PlayerSpawn_Post" )
    
RegisterHamHam_TakeDamage "player" "FwdTakeDamage" )
}

public 
masoquista(id)
{
    
Masoquista[id] = true;
}

public 
Fwd_PlayerSpawn_Post(id)
{
    
Masoquista[id] = false;
}

public 
FwdTakeDamagevictim inflictor attacker Float:damage damage_bits )
{
    return ( 
IsPlayerattacker ) && ( !Masoquistaattacker ] || !Masoquistavictim ] ) && ( get_user_teamvictim ) == get_user_teamattacker ) ) ) ? HAM_SUPERCEDE HAM_IGNORED;    



OM NOM NOM NOM 02-02-2010 18:36

Re: Individual friendly fire
 
@ Bugsy
What do you turn it off?
Type '/maso' once again?

Bugsy 02-02-2010 19:00

Re: Individual friendly fire
 
To make it toggle, replace
PHP Code:

public masoquista(id)
{
        
Masoquista[id] = true;


with
PHP Code:

public masoquista(id)
{
        
Masoquista[id] = !Masoquista[id];
        
client_printid print_chat "* Friendly fire is now %s" Masoquista[id] ? "enabled" "disabled" );



Exolent[jNr] 02-02-2010 19:00

Re: Individual friendly fire
 
It is turned off every time you spawn.

benamo6 02-02-2010 20:57

Re: Individual friendly fire
 
Thanks guys :D
Going to test this.
EDIT: is there a way to make this compatible with Free for all plugin? http://forums.alliedmods.net/showthread.php?t=80208


All times are GMT -4. The time now is 07:26.

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