Raised This Month: $51 Target: $400
 12% 

Solved How can i check if the player is spectator?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obada8
Junior Member
Join Date: May 2016
Old 04-10-2018 , 12:58   How can i check if the player is spectator?
Reply With Quote #1

Hello guys,

I need to know how can i check if the player is a spectator and he is spectating player.

I was tried this to check but not work:

PHP Code:

#define ID_SHOWHUD (taskid - TASK_SHOWHUD)

public ShowHUD(taskid)
{
  new 
iPlayer ID_SHOWHUD
    
    
if (!is_user_alive(iPlayer))
    {
        
iPlayer pev(iPlayerpev_iuser2)
        
        if (!
is_user_alive(iPlayer))
            return
    }

if(
iPlayer != ID_SHOWHUD)

 {

  new 
szName[32]
  
get_user_name(iPlayerszNamecharsmax(szName))

  
// code here
 

Thanks in advance.

Last edited by Obada8; 04-11-2018 at 00:52.
Obada8 is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 04-10-2018 , 14:25   Re: How can i check if the player is spectator?
Reply With Quote #2

if(get_user_team(szName) == 3)
{
// code here
}
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-10-2018 , 15:22   Re: How can i check if the player is spectator?
Reply With Quote #3

Quote:
Originally Posted by raizo11 View Post
if(get_user_team(szName) == 3)
{
// code here
}
You're checking the name's team? Don't try to help if you don't know what you're talking about.
__________________

Last edited by OciXCrom; 04-10-2018 at 15:22.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 04-10-2018 , 15:27   Re: How can i check if the player is spectator?
Reply With Quote #4

depends what he wants becouse i show last write // code here

and I thought he was going to look for his name

Code:
    new szName[32]

    if(get_user_team(iPlayer) == 3)
    {
        get_user_name(iPlayer, szName, charsmax(szName)) 
    }

Last edited by raizo11; 04-10-2018 at 15:39.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-10-2018 , 15:35   Re: How can i check if the player is spectator?
Reply With Quote #5

Sure, he wants to check the team of his name, makes sense. The code will probably compile without any argument mismatch errors, because the get_user_team() function totally requires a string, not an integer. Simply admit that you made a mistake instead of making it worse.
__________________

Last edited by OciXCrom; 04-10-2018 at 15:37.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Obada8
Junior Member
Join Date: May 2016
Old 04-10-2018 , 17:32   Re: How can i check if the player is spectator?
Reply With Quote #6

I solved my problem,

I just delete this

PHP Code:
        if (!is_user_alive(iPlayer)) 
            return 
Because the spectator team actually is dead, so any advise guys to make other protection from bots and other things?

Thanks
Obada8 is offline
Old 04-10-2018, 20:23
fysiks
This message has been deleted by fysiks. Reason: nvm
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 05:33.


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