AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How can detect player while specting (https://forums.alliedmods.net/showthread.php?t=185137)

newcomer 05-13-2012 06:22

How can detect player while specting
 
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 :(

Aooka 05-13-2012 06:49

Re: How can detect player while specting
 
Why do you whant to do with that lol

newcomer 05-13-2012 06:58

Re: How can detect player while specting
 
just try make something

<VeCo> 05-13-2012 07:13

Re: How can detect player while specting
 
Tell us what exactly are you trying to do, else we can't help you.

Aooka 05-13-2012 07:18

Re: How can detect player while specting
 
Yes lol but what exctly ... We cant help you if you don't say us what do you whant to do ..

newcomer 05-13-2012 07:18

Re: How can detect player while specting
 
just need player in spector/dead detect player alive used and not use my command

<VeCo> 05-13-2012 07:20

Re: How can detect player while specting
 
So when typing the command make a loop trough all players and show the message to these, whose pev_iuser2 is equal to the id of the player, typed the command.

ConnorMcLeod 05-13-2012 07:21

Re: How can detect player while specting
 
And don't use PlayerPreThink.

newcomer 05-13-2012 07:26

Re: How can detect player while specting
 
Quote:

Originally Posted by ConnorMcLeod (Post 1708036)
And don't use PlayerPreThink.

then what better sir :D

ConnorMcLeod 05-13-2012 07:36

Re: How can detect player while specting
 
Depends on your need, but since i've not clearly understood what you are trying to do, i couldn't say.


All times are GMT -4. The time now is 00:22.

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