View Single Post
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 06-13-2018 , 22:07   Re: Rewrite invisible_spectator from Reapi
Reply With Quote #5

Quote:
Originally Posted by WaLkMaN View Post
thanks very much, i found on post 74 of that same page

i'm having problem compiling locally on both 1.8.3 and 1.8.2

i'm getting the error on line 13
error 001: expected token: ";", but found "const"
PHP Code:
const m_iTeam 114
but it seems fine, the ";" is there

full code
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < orpheu >
#include < orpheu_memory >

#pragma semicolon 1

#define PLUGIN "Invisible Spectator"
#define VERSION "0.3.1"

#define cm(%0)    ( sizeof(%0) - 1 )

const m_iTeam 114;
const 
TEAM_SPECTATOR 3;

new 
g_bPlayerVisible[33 char];

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
register_clcmd("say""Host_Say"0);
    
register_clcmd("say_team""Host_Say"1);

    
register_event("TeamInfo""Event_TeamInfo""a""2=TERRORIST""2=CT");

    
OrpheuRegisterHookOrpheuGetFunction("SV_FullClientUpdate"), "OnSV_FullClientUpdate"OrpheuHookPre);

    
register_clcmd("amx_spec""ClCmd_Spectate"ADMIN_BAN);
}

// void SV_FullClientUpdate(client_t * client, sizebuf_t *buf)
public OrpheuHookReturn:OnSV_FullClientUpdateclient /*, buffer */ )
{
    new 
userid OrpheuMemoryGetAtAddress(client"userid");
    new 
id find_player("k"userid);

    if( !
g_bPlayerVisible{id} )
    {
        
Util_SVC_UPDATEUSERINFO(0idget_user_userid(id), "");
        return 
OrpheuSupercede;
    }

    return 
OrpheuIgnored;
}

public 
Host_Say(id)
{
    if( !
g_bPlayerVisible{id} )
    {
        
client_print(idprint_chat"Voce esta invisivel agora, fique quieto !!!");
        return 
PLUGIN_HANDLED_MAIN;
    }
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id)
{
    
g_bPlayerVisible{id} = true;
}

public 
client_connect(id)
{
    
g_bPlayerVisible{id} = true;
}

public 
client_disconnected(id)
{
    
g_bPlayerVisible{id} = true;
}

public 
ClCmd_Spectate(idlevel)
{
    if( 
get_user_flags(id) & level && !is_user_alive(id) && get_pdata_int(idm_iTeam) == TEAM_SPECTATOR )
    {
        if( (
g_bPlayerVisible{id} = !g_bPlayerVisible{id}) )
        {
            
client_print(idprint_chat"Voce esta visivel agora");
            
ResetUserModelInfo(id);
        }
        else
        {
            
client_print(idprint_chat"Voce esta visivel agora");
            
Util_SVC_UPDATEUSERINFO(0idget_user_userid(id), "");
        }
        
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

ResetUserModelInfoid )
{
    static const 
model[] = "model";
    static 
value[200];
    
get_user_info(idmodelvaluecm(value));
    
set_user_info(idmodel"");
    
set_user_info(idmodelvalue);
}

Util_SVC_UPDATEUSERINFO(idclIdclUseridclUserInfo[])
{
    
message_begin(id MSG_ONE MSG_ALLSVC_UPDATEUSERINFO_id);
    
write_byte(clId-1);
    
write_long(clUserid);
    
write_string(clUserInfo);
    
write_long(0);
    
write_long(0);
    
write_long(0);
    
write_long(0);
    
message_end();
}

public 
Event_TeamInfo()
{
    new 
id read_data(1);
    if( !
g_bPlayerVisible{id} )
    {
        
g_bPlayerVisible{id} = true;
        
ResetUserModelInfo(id);
    }

tarsisd2 is offline