AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   No freelook using orpheu (https://forums.alliedmods.net/showthread.php?t=318266)

skatz_ws 08-22-2019 11:53

No freelook using orpheu
 
Hey guys!
PHP Code:

public  Observer_IsValidTarget_Pre( const this, const iTarget, const bool:bOnlyTeam 
{
    if(
is_user_alive(iTarget) && skDia == DIA_ESCONDIDAS)
    {
        if(
get_team(iTarget) != 2)
        {
            static 
idid iTarget;
            while ((
id find_ent_by_class(id"player" )) != iTarget 
            {
                if(
get_team(id) != 2
                    continue;
                
                
OrpheuSetParam(2id);
                break;
            }
        }
    }


I have this orpheu function that blocks terrorist to watch another terrorist, just cts cam in first person, but they are allowed to see the other cameras like freelook etc and I want to block that too if its possible (without changing camera server cvars).

Natsheh 08-22-2019 13:11

Re: No freelook using orpheu
 
I do suggest hiding(making them invisible to dead players) them using add to full pack forward.

Also this should be ..
PHP Code:

static idid iTarget
            while ((
id find_ent_by_class(id"player" )) != iTarget )  
            { 
                if(
get_team(id) != 2)  
                    continue; 
                 
                
OrpheuSetParam(2id); 
                break; 
            } 

:arrow:
PHP Code:

       if(get_team(this) == CS_TEAM_T && get_team(iTarget) == CS_TEAM_T) {
            static 
gPlayers[32], pnum;
            
get_players(gPlayerspnum"ahe""CT");
            if(
pnum 0OrpheuSetParam(2gPlayers[0]);
       } 


skatz_ws 08-22-2019 14:39

Re: No freelook using orpheu
 
You use get_team and check if is equal to CS_TEAM? :shock:

Natsheh 08-23-2019 00:44

Re: No freelook using orpheu
 
Quote:

Originally Posted by skatz_ws (Post 2664255)
You use get_team and check if is equal to CS_TEAM? :shock:

I assumed this is for counter strike isn't it?

Purpose for it, is people to understand ( readability ).

Or you could add a define
PHP Code:

 #define TEAM_TERRORIST 1 


skatz_ws 08-27-2019 12:36

Re: No freelook using orpheu
 
Quote:

Originally Posted by Natsheh (Post 2664242)
I do suggest hiding(making them invisible to dead players) them using add to full pack forward.

Also this should be ..
PHP Code:

static idid iTarget
            while ((
id find_ent_by_class(id"player" )) != iTarget )  
            { 
                if(
get_team(id) != 2)  
                    continue; 
                 
                
OrpheuSetParam(2id); 
                break; 
            } 

:arrow:
PHP Code:

       if(get_team(this) == CS_TEAM_T && get_team(iTarget) == CS_TEAM_T) {
            static 
gPlayers[32], pnum;
            
get_players(gPlayerspnum"ahe""CT");
            if(
pnum 0OrpheuSetParam(2gPlayers[0]);
       } 


Sorry, i didnt understand your sugestion in the first place but now I did. How can I make the players invisible using add to full pack forward?

skatz_ws 08-31-2019 07:38

Re: No freelook using orpheu
 
PHP Code:

public fwdAddToFullPack_Post(es_handleeenthosthostflagsplayerpSet

   if(!
player
        return 
FMRES_IGNORED
    
    if(
skDia == DIA_ESCONDIDAS 
    
&& !is_user_alive                 (host
    && !(
get_user_flags                (host) & ADMIN_BAN
    && 
is_user_alive                 (es_handle
    && 
cs_get_user_team                (es_handle) & CS_TEAM_CT)
    {
        
set_es(es_handleES_RenderModekRenderTransTexture); 
        
set_es(es_handleES_RenderAmt0); 
    }
     
    return 
FMRES_IGNORED;


I've made this way, it works, but now I want the spectator to see the players if they are in the ct camera
Can someone help? Anyway to check if the spectator is watching on the first person camera, to make the players visible?

Natsheh 08-31-2019 08:04

Re: No freelook using orpheu
 
es_handle is not a player index but a handle (key) to retrieve/set info

Param ent / e could be a player index (client/guest)

PHP Code:

#if !defined OBS_IN_EYE
  #define OBS_IN_EYE 4
#endIf

public fwdAddToFullPack_Post(es_handleeenthosthostflagsplayerpSet

   if(!
player || is_user_alive(host)) 
        return 
FMRES_IGNORED
    
    if(
skDia == DIA_ESCONDIDAS 
    
&& pev(hostpev_iuser1) != OBS_IN_EYE
    
&& !(get_user_flags(host) & ADMIN_BAN
    && 
is_user_alive(ent
    && 
cs_get_user_team(ent) == CS_TEAM_CT)
    {
        
set_es(es_handleES_RenderModekRenderTransTexture); 
        
set_es(es_handleES_RenderAmt0); 
    }
     
    return 
FMRES_IGNORED;



skatz_ws 08-31-2019 14:35

Re: No freelook using orpheu
 
Quote:

Originally Posted by Natsheh (Post 2665369)
es_handle is not a player index but a handle (key) to retrieve/set info

Param ent / e could be a player index (client/guest)

PHP Code:

#if !defined OBS_IN_EYE
  #define OBS_IN_EYE 4
#endIf

public fwdAddToFullPack_Post(es_handleeenthosthostflagsplayerpSet

   if(!
player || is_user_alive(host)) 
        return 
FMRES_IGNORED
    
    if(
skDia == DIA_ESCONDIDAS 
    
&& pev(hostpev_iuser1) != OBS_IN_EYE
    
&& !(get_user_flags(host) & ADMIN_BAN
    && 
is_user_alive(ent
    && 
cs_get_user_team(ent) == CS_TEAM_CT)
    {
        
set_es(es_handleES_RenderModekRenderTransTexture); 
        
set_es(es_handleES_RenderAmt0); 
    }
     
    return 
FMRES_IGNORED;



It works!! Thanks :)

skatz_ws 09-08-2019 10:57

Re: No freelook using orpheu
 
It's possible to block or make it invisible in overview too?

Natsheh 09-08-2019 14:46

Re: No freelook using orpheu
 
Quote:

Originally Posted by skatz_ws (Post 2666273)
It's possible to block or make it invisible in overview too?

I guess try blocking the forward instead of changing the rendering.


All times are GMT -4. The time now is 17:16.

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