Raised This Month: $ Target: $400
 0% 

How can detect player while specting


Post New Thread Reply   
 
Thread Tools Display Modes
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
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 05-13-2012 , 06:49   Re: How can detect player while specting
Reply With Quote #2

Why do you whant to do with that lol
__________________
Pawn ? Useless
Aooka is offline
newcomer
Member
Join Date: Aug 2011
Old 05-13-2012 , 06:58   Re: How can detect player while specting
Reply With Quote #3

just try make something
newcomer is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-13-2012 , 07:13   Re: How can detect player while specting
Reply With Quote #4

Tell us what exactly are you trying to do, else we can't help you.
__________________
<VeCo> is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 05-13-2012 , 07:18   Re: How can detect player while specting
Reply With Quote #5

Yes lol but what exctly ... We cant help you if you don't say us what do you whant to do ..
__________________
Pawn ? Useless
Aooka is offline
newcomer
Member
Join Date: Aug 2011
Old 05-13-2012 , 07:18   Re: How can detect player while specting
Reply With Quote #6

just need player in spector/dead detect player alive used and not use my command

Last edited by newcomer; 05-13-2012 at 07:19.
newcomer is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-13-2012 , 07:20   Re: How can detect player while specting
Reply With Quote #7

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.
__________________

Last edited by <VeCo>; 05-13-2012 at 07:24.
<VeCo> is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-13-2012 , 07:21   Re: How can detect player while specting
Reply With Quote #8

And don't use PlayerPreThink.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
newcomer
Member
Join Date: Aug 2011
Old 05-13-2012 , 07:26   Re: How can detect player while specting
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
And don't use PlayerPreThink.
then what better sir
newcomer is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-13-2012 , 07:36   Re: How can detect player while specting
Reply With Quote #10

Depends on your need, but since i've not clearly understood what you are trying to do, i couldn't say.
__________________
- tired and retired -

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


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