Raised This Month: $ Target: $400
 0% 

Pass player if attacked?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MasterKy
Junior Member
Join Date: Aug 2009
Old 09-01-2009 , 13:27   Pass player if attacked?
Reply With Quote #1

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGVERSAUTH);
    
register_event("DeathMsg""EVENT_TakeDamage""be")
    
RegisterHam(Ham_TakeDamage"player""EVENT_TakeDamage")
}

public 
EVENT_TakeDamage(id){
new 
iPlayers32 ];
new 
iPlayerCount
get_players
iPlayersiPlayerCount"ae""TERRORIST" ); 
        if(
iPlayerCount == 1){
        
        }else
        if(
iPlayerCount == 2){
        new 
CsTeams:userTeam cs_get_user_team(id)
        if(
get_user_attacker(id)){
            if(
userTeam == CS_TEAM_T) {
            
cs_set_user_team(id,CS_TEAM_CT)
            
captured(id)
                }
            }
        }else{
        new 
CsTeams:userTeam cs_get_user_team(id)
        if(
get_user_attacker(id)){
            if(
userTeam == CS_TEAM_T) {
            
cs_set_user_team(id,CS_TEAM_CT)
            
captured(id)
            
client_print(0,print_chat"Hahaha.A terrorist has been captured!!!",id)
            
server_cmd("amx_execall spk misc/risamalo")
                }
            }
        }
        return 
PLUGIN_CONTINUE

Hello!
this is my plugin but i have a problem
it send the TR player for CT if him be attacked.
I need it to send the terrorist
for CT if a CT shoot him, but do not want him to lose HP and do not want him(Terrorist) to go (to CT team) if a terrorist attack him.

Thanks for all!
MasterKy is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 09-01-2009 , 13:39   Re: Pass player if attacked?
Reply With Quote #2

In the first if, in the true part you must to put anything.
An if can't be without a true part and with a false part.
Remake the condition..
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-01-2009 , 17:38   Re: Pass player if attacked?
Reply With Quote #3

Try this (untested):

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("Plugin Name""1.0""Author");
    
// register_event("DeathMsg", "EVENT_TakeDamage", "be")
    
RegisterHam(Ham_TakeDamage"player""EVENT_TakeDamage")
}

public 
EVENT_TakeDamage(idvictimidinflictoridattackerFloat:damagedamagebits)
{
    if( 
idvictim 33 && idattacker 33 )
    {
        new 
iPlayerCount get_playersnum()
        new 
CsTeams:TeamVictim cs_get_user_team(idvictim)
        new 
CsTeams:TeamAttacker cs_get_user_team(idattacker)
        
        if( 
iPlayerCount && TeamVictim != TeamAttacker )
        {
            switch( 
_:TeamVictim )
            {
                case 
CS_TEAM_CT:
                {
                    
cs_set_user_team(idvictimCS_TEAM_T)
                    
client_print(0print_chat"Hahaha. A Counter-Terrorist has been captured by the Terrorists.")
                }
                case 
CS_TEAM_T:
                {
                    
cs_set_user_team(idvictimCS_TEAM_CT)
                    
client_print(0print_chat"Hahaha. A Terrorist has been captured by the Counter-Terrorists.")
                }
            }
        }
    }

    return 
HAM_SUPERCEDE

__________________
fysiks is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 09-01-2009 , 17:46   Re: Pass player if attacked?
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Try this (untested):

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("Plugin Name""1.0""Author");
    
// register_event("DeathMsg", "EVENT_TakeDamage", "be")
    
RegisterHam(Ham_TakeDamage"player""EVENT_TakeDamage")
}

public 
EVENT_TakeDamage(idvictimidinflictoridattackerFloat:damagedamagebits)
{
    if( 
idvictim 33 && idattacker 33 )
    {
        new 
iPlayerCount get_playersnum()
        new 
CsTeams:TeamVictim cs_get_user_team(idvictim)
        new 
CsTeams:TeamAttacker cs_get_user_team(idattacker)
        
        if( 
iPlayerCount && TeamVictim != TeamAttacker )
        {
            switch( 
_:TeamVictim )
            {
                case 
CS_TEAM_CT:
                {
                    
cs_set_user_team(idvictimCS_TEAM_T)
                    
client_print(0print_chat"Hahaha. A Counter-Terrorist has been captured by the Terrorists.")
                }
                case 
CS_TEAM_T:
                {
                    
cs_set_user_team(idvictimCS_TEAM_CT)
                    
client_print(0print_chat"Hahaha. A Terrorist has been captured by the Counter-Terrorists.")
                }
            }
        }
    }

    return 
HAM_SUPERCEDE

You forgot captured(id) from his code.
zacky is offline
Send a message via Skype™ to zacky
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-01-2009 , 17:54   Re: Pass player if attacked?
Reply With Quote #5

Quote:
Originally Posted by zacky View Post
You forgot captured(id) from his code.
It was intentional. I don't know what it does. All I need to know is if my code is what he needed. Then after that he can add that as he pleases. Everything that he expained in his post is in my code.
__________________
fysiks is offline
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 14:58.


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