It is currently 19 Jun 2018 20:41






Reply to topic  [ 7 posts ] 
 [modificare plugin] amx_spectate 
Author Message
Membru, skill 0
Membru, skill 0

Joined: 27 Oct 2017 00:05
Posts: 70
Location: Romania
Detinator Steam: Da
Fond eXtream: 0
salut,
am bagat pluginul invisible_spectate , merge dar doar la gradul de FONDATOR SI MANAGER , avea acces ADMIN_RCON , am modificat in ADMIN_BAN si ADMIN_KICK , merge tot doar la FONDATOR SI MANAGER ceilalti admini nu au acces la amx_spectate.

sursa:

| Afiseaza codul
/* http://forums.alliedmods.net/showthread ... post551999
*
* Changelog
* added cvar amx_inv_dead_percent <value>
*
*/

#include <amxmodx>
#include <fakemeta>

#if AMXX_VERSION_NUM < 180
#define charsmax(%1) sizeof(%1) - 1
#endif

#define MAX_PLAYERS 32

#define DEAD_FLAG (1<<0)

#define OFFSET_TEAM 114

enum {
CS_TEAM_UNASSIGNED,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
}

new bool:g_roundend
new pcvar_percent
new g_invisible[MAX_PLAYERS+1][2]
new gmsgScoreAttrib, gmsgTeamInfo

public plugin_init() {
register_plugin("Invisible Spectator", "0.2", "ConnorMcLeod")

pcvar_percent = register_cvar("amx_inv_dead_percent", "40")

register_clcmd("amx_spectate", "make_invis", ADMIN_BAN)

gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
gmsgTeamInfo = get_user_msgid("TeamInfo")

register_message( gmsgScoreAttrib, "msg_ScoreAttrib")
register_message( gmsgTeamInfo, "msg_TeamInfo")

register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_logevent("eRoundEnd", 2, "1=Round_End")
register_event("ResetHUD", "eResetHUD", "be")
register_event("DeathMsg", "eDeathMsg", "a")
}

public make_invis(id, level) {
if( ~get_user_flags(id) & level )
return PLUGIN_CONTINUE

if(g_invisible[id][0])
{
client_print(id, print_console, "You're not invisible anymore")
g_invisible[id][0] = 0
return PLUGIN_HANDLED
}

if( is_user_alive(id) )
{
client_print(id, print_console, "You have to be dead first to be an invisible spectator !")
return PLUGIN_HANDLED
}

g_invisible[id][0] = 1
client_print(id, print_console, "You're now an invisible spectator")

new team = get_pdata_int(id, OFFSET_TEAM)
if( CS_TEAM_T <= team <= CS_TEAM_CT )
{
g_invisible[id][1] = team
set_pdata_int(id, OFFSET_TEAM, CS_TEAM_SPECTATOR)
}
else
{
new players[MAX_PLAYERS], tnum, ctnum
get_players(players, tnum, "e", "TERRORIST")
get_players(players, ctnum, "e", "CT")
g_invisible[id][1] = ctnum > tnum ? 1 : 2
}

send_ScoreAttrib(id, 0)

new teamname[12]
switch( g_invisible[id][1] )
{
case 1:formatex(teamname, charsmax(teamname), "TERRORIST")
case 2:formatex(teamname, charsmax(teamname), "CT")
}
send_TeamInfo(id, teamname)

return PLUGIN_HANDLED
}

public eDeathMsg() {
if(g_roundend)
return

new players[MAX_PLAYERS], dead, inum, player, Float:percent = get_pcvar_float(pcvar_percent) / 100.0
get_players(players, dead, "bh")
get_players(players, inum, "h")

if( float(dead) / float(inum) < percent)
return

for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eNewRound() {
g_roundend = false
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, 0)
}
}

public eRoundEnd() {
g_roundend = true
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eResetHUD(id) {
if( g_invisible[id][0] )
g_invisible[id][0] = 0
}

// Doesn't seem to work so set flag to 0 at NewRound event.
public msg_ScoreAttrib(msg_type, msg_dest, target) {
if(!g_invisible[get_msg_arg_int(1)][0])
return PLUGIN_CONTINUE

new flags = get_msg_arg_int(2)
if(flags & DEAD_FLAG)
set_msg_arg_int(2, 0, flags & ~DEAD_FLAG)

return PLUGIN_CONTINUE
}

public msg_TeamInfo(msg_type, msg_dest, target) {
new id = get_msg_arg_int(1)
if(!g_invisible[id][0])
return PLUGIN_CONTINUE

new teamname[12]
get_msg_arg_string(2, teamname, charsmax(teamname))
if( g_invisible[id][1] == CS_TEAM_T && strcmp(teamname, "TERRORIST") != 0 )
set_msg_arg_string(2, "TERRORIST")
else if( g_invisible[id][1] == CS_TEAM_CT && strcmp(teamname, "CT") != 0 )
set_msg_arg_string(2, "CT")

return PLUGIN_CONTINUE
}

send_ScoreAttrib(id, flags)
{
message_begin(MSG_ALL, gmsgScoreAttrib, _, 0)
write_byte(id)
write_byte(flags)
message_end()
}

send_TeamInfo(id, teamname[])
{
message_begin(MSG_ALL, gmsgTeamInfo, _, 0)
write_byte(id)
write_string(teamname)
message_end()
}


adminii cu gradul de sub fondator/manager , cand dau amx_spectate in consola apare: Unknow command: amx_spectate


09 May 2018 22:36
Profile multumesc WWW
Membru, skill 0
Membru, skill 0
User avatar

Joined: 08 Aug 2015 14:23
Posts: 67
Detinator Steam: Da
CS Status: Technology is my life.
Fond eXtream: 0
Miaw wrote:
salut,
am bagat pluginul invisible_spectate , merge dar doar la gradul de FONDATOR SI MANAGER , avea acces ADMIN_RCON , am modificat in ADMIN_BAN si ADMIN_KICK , merge tot doar la FONDATOR SI MANAGER ceilalti admini nu au acces la amx_spectate.

sursa:

| Afiseaza codul
/* http://forums.alliedmods.net/showthread ... post551999
*
* Changelog
* added cvar amx_inv_dead_percent <value>
*
*/

#include <amxmodx>
#include <fakemeta>

#if AMXX_VERSION_NUM < 180
#define charsmax(%1) sizeof(%1) - 1
#endif

#define MAX_PLAYERS 32

#define DEAD_FLAG (1<<0)

#define OFFSET_TEAM 114

enum {
CS_TEAM_UNASSIGNED,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
}

new bool:g_roundend
new pcvar_percent
new g_invisible[MAX_PLAYERS+1][2]
new gmsgScoreAttrib, gmsgTeamInfo

public plugin_init() {
register_plugin("Invisible Spectator", "0.2", "ConnorMcLeod")

pcvar_percent = register_cvar("amx_inv_dead_percent", "40")

register_clcmd("amx_spectate", "make_invis", ADMIN_BAN)

gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
gmsgTeamInfo = get_user_msgid("TeamInfo")

register_message( gmsgScoreAttrib, "msg_ScoreAttrib")
register_message( gmsgTeamInfo, "msg_TeamInfo")

register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_logevent("eRoundEnd", 2, "1=Round_End")
register_event("ResetHUD", "eResetHUD", "be")
register_event("DeathMsg", "eDeathMsg", "a")
}

public make_invis(id, level) {
if( ~get_user_flags(id) & level )
return PLUGIN_CONTINUE

if(g_invisible[id][0])
{
client_print(id, print_console, "You're not invisible anymore")
g_invisible[id][0] = 0
return PLUGIN_HANDLED
}

if( is_user_alive(id) )
{
client_print(id, print_console, "You have to be dead first to be an invisible spectator !")
return PLUGIN_HANDLED
}

g_invisible[id][0] = 1
client_print(id, print_console, "You're now an invisible spectator")

new team = get_pdata_int(id, OFFSET_TEAM)
if( CS_TEAM_T <= team <= CS_TEAM_CT )
{
g_invisible[id][1] = team
set_pdata_int(id, OFFSET_TEAM, CS_TEAM_SPECTATOR)
}
else
{
new players[MAX_PLAYERS], tnum, ctnum
get_players(players, tnum, "e", "TERRORIST")
get_players(players, ctnum, "e", "CT")
g_invisible[id][1] = ctnum > tnum ? 1 : 2
}

send_ScoreAttrib(id, 0)

new teamname[12]
switch( g_invisible[id][1] )
{
case 1:formatex(teamname, charsmax(teamname), "TERRORIST")
case 2:formatex(teamname, charsmax(teamname), "CT")
}
send_TeamInfo(id, teamname)

return PLUGIN_HANDLED
}

public eDeathMsg() {
if(g_roundend)
return

new players[MAX_PLAYERS], dead, inum, player, Float:percent = get_pcvar_float(pcvar_percent) / 100.0
get_players(players, dead, "bh")
get_players(players, inum, "h")

if( float(dead) / float(inum) < percent)
return

for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eNewRound() {
g_roundend = false
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, 0)
}
}

public eRoundEnd() {
g_roundend = true
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eResetHUD(id) {
if( g_invisible[id][0] )
g_invisible[id][0] = 0
}

// Doesn't seem to work so set flag to 0 at NewRound event.
public msg_ScoreAttrib(msg_type, msg_dest, target) {
if(!g_invisible[get_msg_arg_int(1)][0])
return PLUGIN_CONTINUE

new flags = get_msg_arg_int(2)
if(flags & DEAD_FLAG)
set_msg_arg_int(2, 0, flags & ~DEAD_FLAG)

return PLUGIN_CONTINUE
}

public msg_TeamInfo(msg_type, msg_dest, target) {
new id = get_msg_arg_int(1)
if(!g_invisible[id][0])
return PLUGIN_CONTINUE

new teamname[12]
get_msg_arg_string(2, teamname, charsmax(teamname))
if( g_invisible[id][1] == CS_TEAM_T && strcmp(teamname, "TERRORIST") != 0 )
set_msg_arg_string(2, "TERRORIST")
else if( g_invisible[id][1] == CS_TEAM_CT && strcmp(teamname, "CT") != 0 )
set_msg_arg_string(2, "CT")

return PLUGIN_CONTINUE
}

send_ScoreAttrib(id, flags)
{
message_begin(MSG_ALL, gmsgScoreAttrib, _, 0)
write_byte(id)
write_byte(flags)
message_end()
}

send_TeamInfo(id, teamname[])
{
message_begin(MSG_ALL, gmsgTeamInfo, _, 0)
write_byte(id)
write_string(teamname)
message_end()
}


adminii cu gradul de sub fondator/manager , cand dau amx_spectate in consola apare: Unknow command: amx_spectate


Salut, incearca-l si spune-mi daca functioneaza cum doresti....
Apasa | Afiseaza codul
/* http://forums.alliedmods.net/showthread ... post551999
*
* Changelog
* added cvar amx_inv_dead_percent <value>
*
*/

#include <amxmodx>
#include <fakemeta>

#if AMXX_VERSION_NUM < 180
#define charsmax(%1) sizeof(%1) - 1
#endif

#define MAX_PLAYERS 32

#define DEAD_FLAG (1<<0)

#define OFFSET_TEAM 114

enum {
CS_TEAM_UNASSIGNED,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
}

new bool:g_roundend
new pcvar_percent
new g_invisible[MAX_PLAYERS+1][2]
new gmsgScoreAttrib, gmsgTeamInfo

public plugin_init() {
register_plugin("Invisible Spectator", "0.2", "ConnorMcLeod")

pcvar_percent = register_cvar("amx_inv_dead_percent", "40")

register_concmd("amx_spectate", "make_invis", ADMIN_BAN)

gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
gmsgTeamInfo = get_user_msgid("TeamInfo")

register_message( gmsgScoreAttrib, "msg_ScoreAttrib")
register_message( gmsgTeamInfo, "msg_TeamInfo")

register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_logevent("eRoundEnd", 2, "1=Round_End")
register_event("ResetHUD", "eResetHUD", "be")
register_event("DeathMsg", "eDeathMsg", "a")
}

public make_invis(id, level) {
if( ~get_user_flags(id) & level )
return PLUGIN_CONTINUE

if(g_invisible[id][0])
{
client_print(id, print_console, "You're not invisible anymore")
g_invisible[id][0] = 0
return PLUGIN_HANDLED
}

if( is_user_alive(id) )
{
client_print(id, print_console, "You have to be dead first to be an invisible spectator !")
return PLUGIN_HANDLED
}

g_invisible[id][0] = 1
client_print(id, print_console, "You're now an invisible spectator")

new team = get_pdata_int(id, OFFSET_TEAM)
if( CS_TEAM_T <= team <= CS_TEAM_CT )
{
g_invisible[id][1] = team
set_pdata_int(id, OFFSET_TEAM, CS_TEAM_SPECTATOR)
}
else
{
new players[MAX_PLAYERS], tnum, ctnum
get_players(players, tnum, "e", "TERRORIST")
get_players(players, ctnum, "e", "CT")
g_invisible[id][1] = ctnum > tnum ? 1 : 2
}

send_ScoreAttrib(id, 0)

new teamname[12]
switch( g_invisible[id][1] )
{
case 1:formatex(teamname, charsmax(teamname), "TERRORIST")
case 2:formatex(teamname, charsmax(teamname), "CT")
}
send_TeamInfo(id, teamname)

return PLUGIN_HANDLED
}

public eDeathMsg() {
if(g_roundend)
return

new players[MAX_PLAYERS], dead, inum, player, Float:percent = get_pcvar_float(pcvar_percent) / 100.0
get_players(players, dead, "bh")
get_players(players, inum, "h")

if( float(dead) / float(inum) < percent)
return

for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eNewRound() {
g_roundend = false
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, 0)
}
}

public eRoundEnd() {
g_roundend = true
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eResetHUD(id) {
if( g_invisible[id][0] )
g_invisible[id][0] = 0
}

// Doesn't seem to work so set flag to 0 at NewRound event.
public msg_ScoreAttrib(msg_type, msg_dest, target) {
if(!g_invisible[get_msg_arg_int(1)][0])
return PLUGIN_CONTINUE

new flags = get_msg_arg_int(2)
if(flags & DEAD_FLAG)
set_msg_arg_int(2, 0, flags & ~DEAD_FLAG)

return PLUGIN_CONTINUE
}

public msg_TeamInfo(msg_type, msg_dest, target) {
new id = get_msg_arg_int(1)
if(!g_invisible[id][0])
return PLUGIN_CONTINUE

new teamname[12]
get_msg_arg_string(2, teamname, charsmax(teamname))
if( g_invisible[id][1] == CS_TEAM_T && strcmp(teamname, "TERRORIST") != 0 )
set_msg_arg_string(2, "TERRORIST")
else if( g_invisible[id][1] == CS_TEAM_CT && strcmp(teamname, "CT") != 0 )
set_msg_arg_string(2, "CT")

return PLUGIN_CONTINUE
}

send_ScoreAttrib(id, flags)
{
message_begin(MSG_ALL, gmsgScoreAttrib, _, 0)
write_byte(id)
write_byte(flags)
message_end()
}

send_TeamInfo(id, teamname[])
{
message_begin(MSG_ALL, gmsgTeamInfo, _, 0)
write_byte(id)
write_string(teamname)
message_end()
}


09 May 2018 22:55
Profile multumesc YIM
Membru, skill 0
Membru, skill 0

Joined: 27 Oct 2017 00:05
Posts: 70
Location: Romania
Detinator Steam: Da
Fond eXtream: 0
nup, tot nu merge


10 May 2018 00:43
Profile multumesc WWW
Membru, skill 0
Membru, skill 0
User avatar

Joined: 08 Aug 2015 14:23
Posts: 67
Detinator Steam: Da
CS Status: Technology is my life.
Fond eXtream: 0
Miaw wrote:
nup, tot nu merge

hmm ...
Click | Afiseaza codul
/* http://forums.alliedmods.net/showthread ... post551999
*
* Changelog
* added cvar amx_inv_dead_percent <value>
*
*/

#include <amxmodx>
#include <fakemeta>

#if AMXX_VERSION_NUM < 180
#define charsmax(%1) sizeof(%1) - 1
#endif

#define MAX_PLAYERS 32

#define DEAD_FLAG (1<<0)

#define OFFSET_TEAM 114

enum {
CS_TEAM_UNASSIGNED,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
}

new bool:g_roundend
new pcvar_percent
new g_invisible[MAX_PLAYERS+1][2]
new gmsgScoreAttrib, gmsgTeamInfo

public plugin_init() {
register_plugin("Invisible Spectator", "0.2", "ConnorMcLeod")

pcvar_percent = register_cvar("amx_inv_dead_percent", "40")

register_clcmd("amx_spectate", "make_invis", ADMIN_BAN)

gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
gmsgTeamInfo = get_user_msgid("TeamInfo")

register_message( gmsgScoreAttrib, "msg_ScoreAttrib")
register_message( gmsgTeamInfo, "msg_TeamInfo")

register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_logevent("eRoundEnd", 2, "1=Round_End")
register_event("ResetHUD", "eResetHUD", "be")
register_event("DeathMsg", "eDeathMsg", "a")
}

public make_invis(id, level, cid) {
if( (get_user_flags(id) & level) )
return PLUGIN_CONTINUE

if(g_invisible[id][0])
{
client_print(id, print_console, "You're not invisible anymore")
g_invisible[id][0] = 0
return PLUGIN_HANDLED
}

if( is_user_alive(id) )
{
client_print(id, print_console, "You have to be dead first to be an invisible spectator !")
return PLUGIN_HANDLED
}

g_invisible[id][0] = 1
client_print(id, print_console, "You're now an invisible spectator")

new team = get_pdata_int(id, OFFSET_TEAM)
if( CS_TEAM_T <= team <= CS_TEAM_CT )
{
g_invisible[id][1] = team
set_pdata_int(id, OFFSET_TEAM, CS_TEAM_SPECTATOR)
}
else
{
new players[MAX_PLAYERS], tnum, ctnum
get_players(players, tnum, "e", "TERRORIST")
get_players(players, ctnum, "e", "CT")
g_invisible[id][1] = ctnum > tnum ? 1 : 2
}

send_ScoreAttrib(id, 0)

new teamname[12]
switch( g_invisible[id][1] )
{
case 1:formatex(teamname, charsmax(teamname), "TERRORIST")
case 2:formatex(teamname, charsmax(teamname), "CT")
}
send_TeamInfo(id, teamname)

return PLUGIN_HANDLED
}

public eDeathMsg() {
if(g_roundend)
return

new players[MAX_PLAYERS], dead, inum, player, Float:percent = get_pcvar_float(pcvar_percent) / 100.0
get_players(players, dead, "bh")
get_players(players, inum, "h")

if( float(dead) / float(inum) < percent)
return

for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eNewRound() {
g_roundend = false
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, 0)
}
}

public eRoundEnd() {
g_roundend = true
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eResetHUD(id) {
if( g_invisible[id][0] )
g_invisible[id][0] = 0
}

// Doesn't seem to work so set flag to 0 at NewRound event.
public msg_ScoreAttrib(msg_type, msg_dest, target) {
if(!g_invisible[get_msg_arg_int(1)][0])
return PLUGIN_CONTINUE

new flags = get_msg_arg_int(2)
if(flags & DEAD_FLAG)
set_msg_arg_int(2, 0, flags & ~DEAD_FLAG)

return PLUGIN_CONTINUE
}

public msg_TeamInfo(msg_type, msg_dest, target) {
new id = get_msg_arg_int(1)
if(!g_invisible[id][0])
return PLUGIN_CONTINUE

new teamname[12]
get_msg_arg_string(2, teamname, charsmax(teamname))
if( g_invisible[id][1] == CS_TEAM_T && strcmp(teamname, "TERRORIST") != 0 )
set_msg_arg_string(2, "TERRORIST")
else if( g_invisible[id][1] == CS_TEAM_CT && strcmp(teamname, "CT") != 0 )
set_msg_arg_string(2, "CT")

return PLUGIN_CONTINUE
}

send_ScoreAttrib(id, flags)
{
message_begin(MSG_ALL, gmsgScoreAttrib, _, 0)
write_byte(id)
write_byte(flags)
message_end()
}

send_TeamInfo(id, teamname[])
{
message_begin(MSG_ALL, gmsgTeamInfo, _, 0)
write_byte(id)
write_string(teamname)
message_end()
}


10 May 2018 15:25
Profile multumesc YIM
Membru, skill 0
Membru, skill 0

Joined: 27 Oct 2017 00:05
Posts: 70
Location: Romania
Detinator Steam: Da
Fond eXtream: 0
merge , dar nu mai merge la fondator si manager , doar la aia de sub, owner / co-owner ..etc...


10 May 2018 18:26
Profile multumesc WWW
Membru, skill +1
Membru, skill +1
User avatar

Joined: 08 Apr 2014 17:06
Posts: 142
Location: Targu-Jiu
Detinator Steam: Da
Detinator server CS: Da
Fond eXtream: 0
| Afiseaza codul
/* http://forums.alliedmods.net/showthread ... post551999
*
* Changelog
* added cvar amx_inv_dead_percent <value>
*
*/

#include <amxmodx>
#include <fakemeta>

#if AMXX_VERSION_NUM < 180
#define charsmax(%1) sizeof(%1) - 1
#endif

#define MAX_PLAYERS 32

#define DEAD_FLAG (1<<0)

#define OFFSET_TEAM 114

enum {
CS_TEAM_UNASSIGNED,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
}

new bool:g_roundend
new pcvar_percent
new g_invisible[MAX_PLAYERS+1][2]
new gmsgScoreAttrib, gmsgTeamInfo

public plugin_init() {
register_plugin("Invisible Spectator", "0.2", "ConnorMcLeod")

pcvar_percent = register_cvar("amx_inv_dead_percent", "40")

register_clcmd("amx_spectate", "make_invis")

gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
gmsgTeamInfo = get_user_msgid("TeamInfo")

register_message( gmsgScoreAttrib, "msg_ScoreAttrib")
register_message( gmsgTeamInfo, "msg_TeamInfo")

register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_logevent("eRoundEnd", 2, "1=Round_End")
register_event("ResetHUD", "eResetHUD", "be")
register_event("DeathMsg", "eDeathMsg", "a")
}

public make_invis(id) {
if( !(get_user_flags(id) & ADMIN_KICK) )
return PLUGIN_CONTINUE

if(g_invisible[id][0])
{
client_print(id, print_console, "You're not invisible anymore")
g_invisible[id][0] = 0
return PLUGIN_HANDLED
}

if( is_user_alive(id) )
{
client_print(id, print_console, "You have to be dead first to be an invisible spectator !")
return PLUGIN_HANDLED
}

g_invisible[id][0] = 1
client_print(id, print_console, "You're now an invisible spectator")

new team = get_pdata_int(id, OFFSET_TEAM)
if( CS_TEAM_T <= team <= CS_TEAM_CT )
{
g_invisible[id][1] = team
set_pdata_int(id, OFFSET_TEAM, CS_TEAM_SPECTATOR)
}
else
{
new players[MAX_PLAYERS], tnum, ctnum
get_players(players, tnum, "e", "TERRORIST")
get_players(players, ctnum, "e", "CT")
g_invisible[id][1] = ctnum > tnum ? 1 : 2
}

send_ScoreAttrib(id, 0)

new teamname[12]
switch( g_invisible[id][1] )
{
case 1:formatex(teamname, charsmax(teamname), "TERRORIST")
case 2:formatex(teamname, charsmax(teamname), "CT")
}
send_TeamInfo(id, teamname)

return PLUGIN_HANDLED
}

public eDeathMsg() {
if(g_roundend)
return

new players[MAX_PLAYERS], dead, inum, player, Float:percent = get_pcvar_float(pcvar_percent) / 100.0
get_players(players, dead, "bh")
get_players(players, inum, "h")

if( float(dead) / float(inum) < percent)
return

for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eNewRound() {
g_roundend = false
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, 0)
}
}

public eRoundEnd() {
g_roundend = true
new players[MAX_PLAYERS], inum, player
get_players(players, inum)
for(new i; i < inum; i++)
{
player = players[i]
if( g_invisible[player][0] )
send_ScoreAttrib(player, DEAD_FLAG)
}
}

public eResetHUD(id) {
if( g_invisible[id][0] )
g_invisible[id][0] = 0
}

// Doesn't seem to work so set flag to 0 at NewRound event.
public msg_ScoreAttrib(msg_type, msg_dest, target) {
if(!g_invisible[get_msg_arg_int(1)][0])
return PLUGIN_CONTINUE

new flags = get_msg_arg_int(2)
if(flags & DEAD_FLAG)
set_msg_arg_int(2, 0, flags & ~DEAD_FLAG)

return PLUGIN_CONTINUE
}

public msg_TeamInfo(msg_type, msg_dest, target) {
new id = get_msg_arg_int(1)
if(!g_invisible[id][0])
return PLUGIN_CONTINUE

new teamname[12]
get_msg_arg_string(2, teamname, charsmax(teamname))
if( g_invisible[id][1] == CS_TEAM_T && strcmp(teamname, "TERRORIST") != 0 )
set_msg_arg_string(2, "TERRORIST")
else if( g_invisible[id][1] == CS_TEAM_CT && strcmp(teamname, "CT") != 0 )
set_msg_arg_string(2, "CT")

return PLUGIN_CONTINUE
}

send_ScoreAttrib(id, flags)
{
message_begin(MSG_ALL, gmsgScoreAttrib, _, 0)
write_byte(id)
write_byte(flags)
message_end()
}

send_TeamInfo(id, teamname[])
{
message_begin(MSG_ALL, gmsgTeamInfo, _, 0)
write_byte(id)
write_string(teamname)
message_end()
}

_________________
Sunt om cu tine, fii om cu mine !


11 Jun 2018 18:55
Profile multumesc WWW
Fost moderator
Fost moderator
User avatar

Joined: 10 Jul 2013 21:26
Posts: 1490
Location: Constanta
Detinator Steam: Da
CS Status: Nope
Detinator server CS: Nope
SteamID: Nope
Reputatie: Fost Moderator
Fond eXtream: 0
Asigura-te ca ai pus pe FTP versiunea corecta. Sterge .amxx-ul vechi mai intai si apoi il pui pe cel nou sau selecteaza din optiune sa-l rescrie la urcarea pe FTP.

_________________
:information_source: Ofer Servere Counter-Strike 1,6 moca la 10 euro
Image


11 Jun 2018 21:20
Profile multumesc YIM WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 58 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

În cazul în care aveți probleme cu contul trimiteți un email sau mesaj la servicii_extream[arond]yahoo[punct]com

Powered by phpBB® Forum Software © phpBB Group