Raised This Month: $ Target: $400
 0% 

How can detect player while specting


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
newcomer
Member
Join Date: Aug 2011
Old 05-13-2012 , 06:22   How can detect player while specting
Reply With Quote #1

Here's my code

Quote:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Newcomer"


new Status[33]
new name[32]
new HudSync


public plugin_init() {

register_plugin(PLUGIN, VERSION, AUTHOR);

register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0);
register_clcmd("say on", "on");
register_clcmd("say off", "off");


}

public on(id)
{
Status[id] = true;
}


public off(id)
{
Status[id] = false;
}


public fwdPlayerPreThink(id)
{
if(is_user_alive(id))
return FMRES_IGNORED;

static Target;
Target = pev(id, pev_iuser2);

if(!is_user_alive(Target))
return FMRES_IGNORED;


if(Status[Target])
{
get_user_name(Target,name,31)
set_hudmessage(255, 0, 0, -1.0, 0.3, 0, 6.0, 4.0, 0.1, 0.1);
ShowSyncHudMsg(id, HudSync, "%s turned on",name);
return FMRES_HANDLED;
}
else if (!Status[Target])
{
get_user_name(Target,name,31)
set_hudmessage(255, 0, 0, -1.0, 0.3, 0, 6.0, 4.0, 0.1, 0.1);
ShowSyncHudMsg(id, HudSync, "%s not turn on",name);
return FMRES_HANDLED;
}
return FMRES_IGNORED;
}
It's not work well. If not click mouse, it will not work. I don't know why

Last edited by newcomer; 05-13-2012 at 07:24.
newcomer is offline
 



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 00:22.


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