hi guys, first of all sorry for the bad english, i'm using google translator.
I would like your help in something that I'm trying to do.
I want to add one more option in the combo of options for using adrenaline, the 4 possible combos are speed, berserk, regenerate and invisibility; and I want to add one more, I was able to edit the original sma and add one more option, it appears in the menu and the adrenaline is used when selecting the option, but I was unable to make the function of that option work. I attached the sma that I edited here, for you to see what I edited.
the function I want in this option is that when a player kills another using the knife, the frags of the one who died are reset.
I have a plugin that does this, its code is this:
Code:
#include < amxmodx >
#include < cstrike >
#include < fun >
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
public plugin_init( )
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event( "DeathMsg", "e_DeathMsg", "a" );
}
public e_DeathMsg( id )
{
new Attacker = read_data( 1 );
new iVictim = read_data( 2 );
new WeaponID = get_user_weapon( Attacker );
new szName[ 2 ][ 33 ];
get_user_name( iVictim, szName[ 0 ], 32 );
get_user_name( Attacker, szName[ 1 ], 32 );
if( iVictim )
{
if( WeaponID == CSW_KNIFE )
{
set_user_frags( iVictim, 0 );
cs_set_user_deaths( iVictim, -1 );
new i = get_user_frags( Attacker );
set_user_frags( Attacker, i+1 );
set_hudmessage(0, 255, 0, 0.02, 0.66, 2, 1.0, 7.0, 0.03, 0.2)
show_hudmessage(0,"%s... Teve seu FRAG resetado^nPois morreu na faca por: %s...!", szName[ 0 ], szName[ 1 ]);
}
}
}
// Stock
stock ColorChat(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!n", "^1")
replace_all(msg, 190, "!t", "^3")
replace_all(msg, 190, "!t2", "^0")
if (id) players[0] = id; else get_players(players, count, "ch")
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
and it works perfectly, but I just wanted to be able to reset the frags of another player using adrenaline, so I added the code for this plugin in the jctf sma, but I couldn't make it work
I understand that the "DeathMsg" event is necessary to work, but I came across a problem
if I record the event, as seen in line 1270 of the sma that I attached, the coding works but all players can use the knife freely to reset the frags of another player without the use of adrenaline,
but if I don't register the event the code doesn't work
on line 3651 of the sma that I attached you can see the code that I added.
Code:
case KNIFE_RESET:
{
new Attacker = read_data( 1 );
new iVictim = read_data( 2 );
new WeaponID = get_user_weapon( Attacker );
new szName[ 2 ][ 33 ];
get_user_name( iVictim, szName[ 0 ], 32 );
get_user_name( Attacker, szName[ 1 ], 32 );
if( iVictim )
{
if( WeaponID == CSW_KNIFE )
{
set_user_frags( iVictim, 0 );
cs_set_user_deaths( iVictim, -1 );
new i = get_user_frags( Attacker );
set_user_frags( Attacker, i+1 );
set_hudmessage(0, 255, 0, 0.02, 0.66, 2, 1.0, 7.0, 0.03, 0.2)
show_hudmessage(0,"%s... His FRAG was reset^nbecause he died under the knife for: %s...!", szName[ 0 ], szName[ 1 ]);
}
}
}
in short, I want exactly this function to reset the frags of a birthday by killing him using the knife, but only with the use of adrenaline.
can anybody help me? I understand almost nothing about programming and can only edit parts of the code.