Raised This Month: $ Target: $400
 0% 

Why does those 2 plugins not work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-27-2013 , 06:13   Why does those 2 plugins not work?
Reply With Quote #1

So i searched around for things i needed. I found those two by Arkshine.
But i tried them and none works. I don't know why.



Code:
    #include <amxmodx>         new gi_FriendlyFire;         public plugin_init ()     {         register_plugin ( "Block Attack/Kill Teammates Messages", "1.0.0", "Arksine" );                 gi_FriendlyFire = get_cvar_pointer ( "mp_friendlyfire" );                 if ( !get_pcvar_num ( gi_FriendlyFire ) )         {             pause ( "ad" );             return;         }                 register_message ( get_user_msgid ( "TextMsg" ), "m_TextMsg" );     }         public m_TextMsg ( msg_id, msg_type, msg_id )     {         if ( get_msg_arg_int ( 1 ) == print_notify )         {             return PLUGIN_CONTINUE;         }             static s_Message[ 22 ];         get_msg_arg_string  ( 2, s_Message, charsmax ( s_Message ) );                 if ( equal ( s_Message, "#Game_teammate_attack" ) || equal ( s_Message, "#Killed_Teammate" ) || equal ( s_Message, "#Game_teammate_kills" ) )         {             return PLUGIN_HANDLED;         }                 return PLUGIN_CONTINUE;     }         /* -- Informations --             s_Message = #Game_teammate_attack | print_chat         s_Message = #Killed_Teammate      | print_center         s_Message = #Game_teammate_kills  | print_console     */

Second request :

Code:
      #include <amxmodx>     #include <fakemeta>         #define FRAGS_TO_ADD 1         new gi_FriendlyFire;         #define MAX_CLIENTS 32     new bool:gb_TeamKill[ MAX_CLIENTS + 1 ];         public plugin_init ()     {         register_plugin ( "Teamkill Frag", "1.0.0", "Arksine" );                 gi_FriendlyFire = get_cvar_pointer ( "mp_friendlyfire" );                 if ( !get_pcvar_num ( gi_FriendlyFire ) )         {             pause ( "ad" );             return;         }                 register_event ( "DeathMsg", "e_DeathMsg", "a" );         register_message ( get_user_msgid ( "ScoreInfo" ), "m_ScoreInfo" );     }             public client_putinserver ( id )     {         gb_TeamKill[ id ] = false;     }         public m_ScoreInfo ( msg_id, msg_type, msg_id )     {         new id = get_msg_arg_int ( 1 );           if ( gb_TeamKill[ id ] )         {             gb_TeamKill[ id ] = false;             new i_CurrentFrag = get_msg_arg_int ( 2 );                         i_CurrentFrag += FRAGS_TO_ADD + 1;                         set_pev ( id, pev_frags, i_CurrentFrag * 1.0 );             set_msg_arg_int ( 2, ARG_SHORT, i_CurrentFrag );         }     }         public e_DeathMsg ()     {           new i_Killer = read_data ( 1 );         new i_Victim = read_data ( 2 );                 if ( get_user_team ( i_Killer ) == get_user_team ( i_Victim ) )         {             gb_TeamKill[ i_Killer ] = true;         }     }


Link to thread: https://www.sourcemod.net/showthread.php?t=72295
MrKiller2010 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-27-2013 , 06:36   Re: Why does those 2 plugins not work?
Reply With Quote #2

Should work, but code is old anyway and amxx has new tools that make it easier to achieve.

Try this :

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

#pragma semicolon 1

#define PLUGIN "No Team Attack"
#define VERSION "0.0.1"

const m_iTeam 114;

new 
g_iMaxPlayers;
#define IsPlayer(%0)    ( 1 <= (%0) <= g_iMaxPlayers )

new mp_friendlyfire;
new 
HamHook:g_iHhCBPlayerTakeDamagePost;

new 
g_iRealTeam[33 char];

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
mp_friendlyfire get_cvar_pointer("mp_friendlyfire");
    if( !
mp_friendlyfire )
    {
        
pause("ac");
        return;
    }

    
RegisterHam(Ham_TakeDamage"player""OnCBasePlayer_TakeDamage"false);
    
DisableHamForwardg_iHhCBPlayerTakeDamagePost RegisterHam(Ham_TakeDamage"player""OnCBasePlayer_TakeDamage_P"true) );
    
g_iMaxPlayers get_maxplayers();
}

public 
client_putinserver(id)
{
    
g_iRealTeam{id} = 0;
}

public 
OnCBasePlayer_TakeDamageidiInflictoriAttackerFloat:flDamagebitsDamageType // return int
{
    static 
iTeam;
    if( 
IsPlayer(iAttacker) && id != iAttacker && get_pcvar_num(mp_friendlyfire) && get_pdata_int(idm_iTeam) == (iTeam get_pdata_int(iAttackerm_iTeam)) )
    {
        
g_iRealTeam{iAttacker} = iTeam;
        
set_pdata_int(iAttackerm_iTeamiTeam);
        
EnableHamForward(g_iHhCBPlayerTakeDamagePost);
        return 
HAM_HANDLED;
    }
    return 
HAM_IGNORED;
}

public 
OnCBasePlayer_TakeDamage_P(idiInflictoriAttacker)
{
    new 
iTeam g_iRealTeam{iAttacker};
    if( 
iTeam )
    {
        
set_pdata_int(iAttackerm_iTeamiTeam);
        
g_iRealTeam{iAttacker} = 0;
    }

    
DisableHamForward(g_iHhCBPlayerTakeDamagePost);
    return 
HAM_HANDLED;

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-27-2013 at 08:03.
ConnorMcLeod is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-27-2013 , 06:41   Re: Why does those 2 plugins not work?
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Should work, but code is old anyway and amxx has new tools that make it easier to achieve.

Try this :

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

#pragma semicolon 1

#define PLUGIN "No Team Attack"
#define VERSION "0.0.1"

const m_iTeam 114;

new 
g_iMaxPlayers;
#define IsPlayer(%0)    ( 1 <= (%0) <= g_iMaxPlayers )

new mp_friendlyfire;
new 
HamHook:g_iHhCBPlayerTakeDamagePost;

new 
g_iRealTeam[33 char];

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
mp_friendlyfire get_cvar_pointer("mp_friendlyfire");
    if( !
mp_friendlyfire )
    {
        
pause("ac");
        return;
    }

    
RegisterHam(Ham_TakeDamage"player""OnCBasePlayer_TakeDamage"false);
    
DisableHamForwardg_iHhCBPlayerTakeDamagePost RegisterHam(Ham_TakeDamage"player""OnCBasePlayer_TakeDamage_P"true) );
    
g_iMaxPlayers get_maxplayers();
}

public 
client_putinserver(id)
{
    
g_iRealTeam{iAttacker} = 0;
}

public 
OnCBasePlayer_TakeDamageidiInflictoriAttackerFloat:flDamagebitsDamageType // return int
{
    static 
iTeam;
    if( 
IsPlayer(iAttacker) && id != iAttacker && get_pcvar_num(mp_friendlyfire) && get_pdata_int(idm_iTeam) == (iTeam get_pdata_int(iAttackerm_iTeam)) )
    {
        
g_iRealTeam{iAttacker} = iTeam;
        
set_pdata_int(iAttackerm_iTeamiTeam);
        
EnableHamForward(g_iHhCBPlayerTakeDamagePost);
        return 
HAM_HANDLED;
    }
    return 
HAM_IGNORED;
}

public 
OnCBasePlayer_TakeDamage_P(idiInflictoriAttacker)
{
    new 
iTeam g_iRealTeam{iAttacker};
    if( 
iTeam )
    {
        
set_pdata_int(iAttackerm_iTeamiTeam);
        
g_iRealTeam{iAttacker} = 0;
    }

    
DisableHamForward(g_iHhCBPlayerTakeDamagePost);
    return 
HAM_HANDLED;

Getting this: Error: Undefined symbol "iAttacker" on line 38
And what about the other plugin?
i want both
MrKiller2010 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-27-2013 , 08:03   Re: Why does those 2 plugins not work?
Reply With Quote #4

Ops, fixed.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-27-2013 , 08:50   Re: Why does those 2 plugins not work?
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Ops, fixed.
Thanks, and what about the other plugin?
MrKiller2010 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-27-2013 , 08:53   Re: Why does those 2 plugins not work?
Reply With Quote #6

Not needed anymore.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-27-2013 , 08:57   Re: Why does those 2 plugins not work?
Reply With Quote #7

But when T kills a teammate they still get -1 in frags.
I want them to get +1 frag when they TK, i mean so it counts as a normal frag.
MrKiller2010 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-27-2013 , 09:07   Re: Why does those 2 plugins not work?
Reply With Quote #8

This shouldn't happen.
May be you have tested with czero bots ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-27-2013 , 09:09   Re: Why does those 2 plugins not work?
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
This shouldn't happen.
May be you have tested with czero bots ?
No, It's a regluar server. Jailbreak.
I am having a game menu plugin thats gives dodgeballs to T.
T against Ts..
still -1...

I can send you the IP if you think i am using csz bots..
MrKiller2010 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-27-2013 , 09:10   Re: Why does those 2 plugins not work?
Reply With Quote #10

I trust you, i was just asking.
Gonna test the plugin on my local server.

Edit : Works fine, after 2 TKs, my score is 2:0
Attached Thumbnails
Click image for larger version

Name:	de_dust2.png
Views:	102
Size:	68.7 KB
ID:	123267  
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-27-2013 at 09:26.
ConnorMcLeod 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 06:24.


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