Raised This Month: $ Target: $400
 0% 

How to detect exactly special Attacker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
newcomer
Member
Join Date: Aug 2011
Old 04-24-2013 , 05:43   How to detect exactly special Attacker
Reply With Quote #1

I have try detect special attacker, but it's not excatly, sometimes it's not show anything.
And I thing the code isn't well, my server have little laggy if run this detect
Please help me
Note: STEAM_0:0:1111111111 is just example
Quote:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define IsPlayer(%1) (1<=%1<=g_MaxPlayers)

new g_MaxPlayers;
new bool:detected[33]
new g_szAuthid[33]

public plugin_init()
{
RegisterHam(Ham_TraceAttack, "player", "HamTraceAttack")
g_MaxPlayers = get_maxplayers()
}

public client_putinserver(id)
{
detected[id] = false
set_task(2.0,"detect_player",id)
}

public detect_player(id)
{
get_user_authid(id, g_szAuthid[id], 32)
if (equal(g_szAuthid, "STEAM_0:0:1111111111"))
{
detected[id] = true
}
else
{
detected[id] = false
}
}

public HamTraceAttack(Vic, Att, Float:dmg, Float:dir[3], traceresult, dmgbits)
{
if (!detected[Att] || Vic == Att || !IsPlayer(Att))
{
return HAM_IGNORED;
}


if (detected[Att])
{
if (get_tr2(traceresult,TR_iHitgroup) == HIT_HEAD)
{
client_print(detected[Att], print_chat,"You're pro")
}
return HAM_IGNORED;
}

return HAM_IGNORED;
}

Last edited by newcomer; 04-24-2013 at 09:12.
newcomer is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-24-2013 , 07:48   Re: How to detect exactly special Attacker
Reply With Quote #2

You need to make g_szAuthid global and add a second dimension to it.
Also indent your code for the sake of readability.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 04-24-2013 at 07:49.
hornet is offline
newcomer
Member
Join Date: Aug 2011
Old 04-24-2013 , 09:13   Re: How to detect exactly special Attacker
Reply With Quote #3

it's still not exactly
is it poor code ?
newcomer is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-24-2013 , 09:19   Re: How to detect exactly special Attacker
Reply With Quote #4

You did not add the second dimension:
Code:
new g_szAuthid[ 33 ][ 32 ];
And then every time you use it you must use g_szAuthid[ id ].

And then:
Code:
get_user_authid(id, g_szAuthid[id], 31 )
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
newcomer
Member
Join Date: Aug 2011
Old 04-24-2013 , 12:37   Re: How to detect exactly special Attacker
Reply With Quote #5

then don't need this ?
Quote:
detected[33]
and how can use g_szAuthid for detect special attacker ?

Last edited by newcomer; 04-24-2013 at 16:30.
newcomer 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 10:51.


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