Raised This Month: $ Target: $400
 0% 

Individual friendly fire


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 02-02-2010 , 18:03   Individual friendly fire
Reply With Quote #1

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)  
    }

__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it
benamo6 is offline
Send a message via MSN to benamo6
OM NOM NOM NOM
Member
Join Date: Jan 2010
Old 02-02-2010 , 18:25   Re: Individual friendly fire
Reply With Quote #2

I love the idea.
OM NOM NOM NOM is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-02-2010 , 18:26   Re: Individual friendly fire
Reply With Quote #3

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;    

__________________

Last edited by Bugsy; 02-02-2010 at 19:04.
Bugsy is offline
OM NOM NOM NOM
Member
Join Date: Jan 2010
Old 02-02-2010 , 18:36   Re: Individual friendly fire
Reply With Quote #4

@ Bugsy
What do you turn it off?
Type '/maso' once again?
OM NOM NOM NOM is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-02-2010 , 19:00   Re: Individual friendly fire
Reply With Quote #5

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" );

__________________
Bugsy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-02-2010 , 19:00   Re: Individual friendly fire
Reply With Quote #6

It is turned off every time you spawn.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 02-02-2010 , 20:57   Re: Individual friendly fire
Reply With Quote #7

Thanks guys
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
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it

Last edited by benamo6; 02-02-2010 at 21:43.
benamo6 is offline
Send a message via MSN to benamo6
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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