AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why does those 2 plugins not work? (https://forums.alliedmods.net/showthread.php?t=221854)

MrKiller2010 07-27-2013 06:13

Why does those 2 plugins not work?
 
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

ConnorMcLeod 07-27-2013 06:36

Re: Why does those 2 plugins not work?
 
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;



MrKiller2010 07-27-2013 06:41

Re: Why does those 2 plugins not work?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1999740)
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

ConnorMcLeod 07-27-2013 08:03

Re: Why does those 2 plugins not work?
 
Ops, fixed.

MrKiller2010 07-27-2013 08:50

Re: Why does those 2 plugins not work?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1999785)
Ops, fixed.

Thanks, and what about the other plugin?

ConnorMcLeod 07-27-2013 08:53

Re: Why does those 2 plugins not work?
 
Not needed anymore.

MrKiller2010 07-27-2013 08:57

Re: Why does those 2 plugins not work?
 
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.

ConnorMcLeod 07-27-2013 09:07

Re: Why does those 2 plugins not work?
 
This shouldn't happen.
May be you have tested with czero bots ?

MrKiller2010 07-27-2013 09:09

Re: Why does those 2 plugins not work?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1999830)
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..

ConnorMcLeod 07-27-2013 09:10

Re: Why does those 2 plugins not work?
 
2 Attachment(s)
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


All times are GMT -4. The time now is 06:24.

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