Quote:
Originally Posted by WaLkMaN
|
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_plugin( PLUGIN, VERSION, "ConnorMcLeod" );
register_clcmd("say", "Host_Say", 0);
register_clcmd("say_team", "Host_Say", 1);
register_event("TeamInfo", "Event_TeamInfo", "a", "2=TERRORIST", "2=CT");
OrpheuRegisterHook( OrpheuGetFunction("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_FullClientUpdate( client /*, buffer */ )
{
new userid = OrpheuMemoryGetAtAddress(client, "userid");
new id = find_player("k", userid);
if( !g_bPlayerVisible{id} )
{
Util_SVC_UPDATEUSERINFO(0, id, get_user_userid(id), "");
return OrpheuSupercede;
}
return OrpheuIgnored;
}
public Host_Say(id)
{
if( !g_bPlayerVisible{id} )
{
client_print(id, print_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(id, level)
{
if( get_user_flags(id) & level && !is_user_alive(id) && get_pdata_int(id, m_iTeam) == TEAM_SPECTATOR )
{
if( (g_bPlayerVisible{id} = !g_bPlayerVisible{id}) )
{
client_print(id, print_chat, "Voce esta visivel agora");
ResetUserModelInfo(id);
}
else
{
client_print(id, print_chat, "Voce esta visivel agora");
Util_SVC_UPDATEUSERINFO(0, id, get_user_userid(id), "");
}
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
ResetUserModelInfo( id )
{
static const model[] = "model";
static value[200];
get_user_info(id, model, value, cm(value));
set_user_info(id, model, "");
set_user_info(id, model, value);
}
Util_SVC_UPDATEUSERINFO(id, clId, clUserid, clUserInfo[])
{
message_begin(id ? MSG_ONE : MSG_ALL, SVC_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);
}
}