|
Author
|
Message
|
|
Member
|

05-13-2012
, 06:22
How can detect player while specting
|
#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.
|
|
|
|