ttt_show_infos cambio a hud
#1
este plugins funciona con motd me gustaria cambairlo por mensajes hud mas simple 
me podrian ayudar

que salga un mensaje hud en vez que aparesca el motd

Código PHP:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <ttt>

new g_iCached[2], g_iKilledWho[33][33], g_pCommandMenuID1g_pCommandMenuID2g_iPlayerStates[33][2];
new const 
g_szIconNames[][] = 
{
"suicide""p228""""scout""hegrenade""xm1014""c4""mac10""aug""hegrenade""elite""fiveseven",
"ump45""sg550""galil""famas""usp""glock18""awp""mp5navy""m249""m3""m4a1""tmp""g3sg1""hegrenade",
"deagle""sg552""ak47""crowbar""p90""0""1""2""3"
};

new const 
g_szColors[][] = 
{
"#848284"// grey
"#fc0204"// red
"#0402fc"// blue
"#048204"// green
"#E211F5"// purple
"#F57011"  // orange
};

public 
plugin_precache()
{
static 
icon[32];
for(new 
0<= charsmax(g_szIconNames); i++)
{
if(
&& strlen(g_szIconNames[i]) < 3) continue;
formatex(iconcharsmax(icon), "gfx/ttt/%s.gif"g_szIconNames[i]);
precache_generic(icon);
}
}

public 
plugin_init()
{
register_plugin("[TTT] Show infos"TTT_VERSIONTTT_AUTHOR);

// register_clcmd("say /tttme", "ttt_show_me");
// register_clcmd("say_team /tttme", "ttt_show_me");
g_pCommandMenuID1 ttt_command_add("/me");
g_pCommandMenuID2 ttt_command_add("Last states");

RegisterHamPlayer(Ham_Killed"Ham_Killed_post"1);
}

public 
ttt_command_selected(idmenuidname[])
{
if(
g_pCommandMenuID1 == menuid)
ttt_show_me(id);
else if(
g_pCommandMenuID2 == menuid)
show_last_states(id);
}

public 
ttt_gamemode(gamemode)
{
if(
gamemode == GAME_PREPARING || gamemode == GAME_RESTARTING || gamemode == GAME_STARTED)
{
new 
numid;
static 
players[32];
get_players(playersnum);
for(--
numnum >= 0num--)
{
id players[num];
reset_player(id);
if(
gamemode == GAME_STARTED)
swap_player_states(id);
}

if(
gamemode == GAME_STARTED)
g_iCached[1] = false;
}
}

public 
client_putinserver(id)
{
g_iPlayerStates[id][0] = -1;
g_iPlayerStates[id][1] = -1;
reset_player(idid);
}

stock swap_player_states(id)
{
g_iPlayerStates[id][0] = g_iPlayerStates[id][1];
g_iPlayerStates[id][1] = ttt_get_playerstate(id);
}

stock reset_player(idother 0)
{
new 
numplayer;
static 
players[32];
get_players(playersnum);
for(--
numnum >= 0num--)
{
player players[num];
g_iKilledWho[id][player] = false;
if(
other)
{
g_iKilledWho[player][id] = false;
}
}
}

public 
ttt_winner(team)
{
g_iCached[0] = false;
g_iCached[1] = false;
new 
numid;
static 
players[32];
get_players(playersnum);
for(--
numnum >= 0num--)
{
id players[num];
client_cmd(id"-attack");
client_cmd(id"-attack2");
show_motd_winner(id);
}
}

public 
ttt_showinfo(idtarget)
{
new 
mode ttt_get_gamemode(); 
if(!
is_user_alive(target) && is_user_alive(id) &&  mode != GAME_ENDED && mode != GAME_OFF)
show_motd_info(idtarget);
}

public 
ttt_show_me(id)
{
if(
ttt_get_gamemode() == GAME_OFF)
return;

if(!
is_user_alive(id))
{
const 
SIZE 1536;
static 
msg[SIZE+1];
new 
len;

len += formatex(msg[len], SIZE len"<html><head><meta charset='utf-8'><style>body{background:#ebf3f8 no-repeat center top;}</style></head><body>");
len += formatex(msg[len], SIZE len"</br><center><h2>%L</h2></center>"id"TTT_WINNER_LINE7");

new 
numplayercountalive_state;
static 
players[32], name[32];
get_players(playersnum);
for(--
numnum >= 0num--)
{
player players[num];
if(
g_iKilledWho[id][player])
{
count++;
alive_state ttt_get_alivestate(player);
get_user_name(playernamecharsmax(name));
len += formatex(msg[len], SIZE len"<b style='color:%s'>[%L] %s</b></br>"g_szColors[alive_state], idspecial_names[alive_state], name);
}
}

if(!
countlen += formatex(msg[len], SIZE len"%L"id"TTT_WINNER_LINE6");
len += formatex(msg[len], SIZE len"</body></html>");

show_motd(idmsg"");
}
else 
client_print_color(idprint_team_default"%s %L"TTT_TAGid"TTT_ALIVE");
}

public 
Ham_Killed_post(victimkillershouldgib)
{
if(!
is_user_connected(killer))
killer ttt_find_valid_killer(victimkiller);

if(!
is_user_connected(killer) || ttt_get_gamemode() == GAME_ENDED)
return 
HAM_IGNORED;

g_iKilledWho[killer][victim] = ttt_get_alivestate(victim);
return 
HAM_HANDLED;
}

public 
show_motd_winner(id)
{
if(!
is_user_connected(id) || ttt_get_gamemode() == GAME_OFF)
return;

const 
SIZE 1536;
static 
wholemsg[SIZE+1], msg[SIZE+1], motdname[64], staticsize;
new 
zumlen;
if(!
g_iCached[0])
{
new 
ihighestnumkilledstatecurrentstate;
new 
name[32], Traitors[256], Detectives[256], suicide[128], kills[128], c4[70], out[64], players[32];

get_players(playersnum);
for(--
numnum >= 0num--)
{
players[num];

killedstate ttt_get_alivestate(i);
currentstate ttt_get_playerstate(i);
get_user_name(inamecharsmax(name));

if(
currentstate == PC_TRAITOR || killedstate == PC_TRAITOR)
format(Traitorscharsmax(Traitors), "%s, %s"nameTraitors);

if(
currentstate == PC_DETECTIVE || killedstate == PC_DETECTIVE)
format(Detectivescharsmax(Detectives), "%s, %s"nameDetectives);

if(
ttt_get_playerdata(iPD_KILLEDBY) == 3005)
format(suicidecharsmax(suicide), "%s, %s"namesuicide);

if(
ttt_get_playerdata(iPD_C4EXPLODED))
format(c4charsmax(c4), "%s, %s"namec4);

if(
ttt_get_playerdata(iPD_KILLCOUNT) > highest)
{
if(
currentstate != PC_DEAD)
zum currentstate;
else 
zum killedstate;

highest ttt_get_playerdata(iPD_KILLCOUNT);
formatex(killscharsmax(kills), "%L"LANG_SERVER"TTT_WINNER_LINE4"g_szColors[zum], LANG_SERVERspecial_names[zum], namehighest);
}
}

if(
strlen(Traitors) > 2)
Traitors[strlen(Traitors)-2] = '^0';

if(
strlen(Detectives) > 2)
Detectives[strlen(Detectives)-2] = '^0';

if(
strlen(suicide) > 2)
suicide[strlen(suicide)-2] = '^0';

if(
strlen(c4) > 2)
c4[strlen(c4)-2] = '^0';

new 
winner ttt_get_winner();
if(
winner == PC_DETECTIVE)
winner++;

if(
winner == PC_TRAITOR)
formatex(outcharsmax(out), "%L"LANG_SERVER"TTT_TWIN");
else if(
winner == PC_INNOCENT)
formatex(outcharsmax(out), "%L"LANG_SERVER"TTT_IWIN");

len += formatex(msg[len], SIZE len"<html><head><meta charset='utf-8'><style>body{background:#ebf3f8 url('gfx/ttt/%d.gif') no-repeat center top;}</style></head><body>"winner);
len += formatex(msg[len], SIZE len"</br><center><h1>%s</h1></center>"out);

if(
strlen(Detectives) > 0)
len += formatex(msg[len], SIZE len"<b style='color:%s'>%L: %s</b><br/>"g_szColors[PC_DETECTIVE], LANG_SERVERspecial_names[PC_DETECTIVE], Detectives);
len += formatex(msg[len], SIZE len"<b style='color:%s'>%L: %s</b><br/><br/>"g_szColors[PC_TRAITOR], LANG_SERVERspecial_names[PC_TRAITOR], Traitors);

if(
strlen(kills) > 0)
len += formatex(msg[len], SIZE len"%s<br/>"kills);

if(
strlen(suicide) > 0)
len += formatex(msg[len], SIZE len"<b style='color:%s'>%L<br/>"g_szColors[PC_SPECIAL], LANG_SERVER"TTT_WINNER_LINE2"suicide);

if(
strlen(c4) > 0)
len += formatex(msg[len], SIZE len"<b style='color:%s'>%L<br/>"g_szColors[PC_SPECIAL], LANG_SERVER"TTT_WINNER_LINE3"c4);

formatex(motdnamecharsmax(motdname), "%L"LANG_SERVER"TTT_WINNER_LINE1");
g_iCached[0] = true;
staticsize len;
}
len staticsize;
formatex(wholemsgcharsmax(msg), "%s"msg);

// len += formatex(wholemsg[len], SIZE - len, "%L</br>", LANG_SERVER, "TTT_WINNER_LINE7");
new numplayercountalive_state;
static 
players[32], name[32];
get_players(playersnum);
for(--
numnum >= 0num--)
{
player players[num];
if(
g_iKilledWho[id][player])
{
count++;
alive_state ttt_get_alivestate(player);
get_user_name(playernamecharsmax(name));
len += formatex(wholemsg[len], SIZE len"%L <b style='color:%s'>[%L] %s</b></br>"LANG_SERVER"TTT_WINNER_LINE7"g_szColors[alive_state], LANG_SERVERspecial_names[alive_state], name);
}
}

if(!
countformatex(wholemsg[len], SIZE len"%L"id"TTT_WINNER_LINE6");

new 
karma ttt_get_playerdata(idPD_KARMA), karmatemp ttt_get_playerdata(idPD_KARMATEMP);
zum ttt_get_alivestate(id);
len += formatex(wholemsg[len], SIZE len"%L<br/>"LANG_SERVER"TTT_WINNER_LINE5"g_szColors[zum], karmag_szColors[zum], karmatemp-karmag_szColors[zum], karmatemp);
len += formatex(wholemsg[len], SIZE len"</body></html>");

show_motd(idwholemsgmotdname);
wholemsg[0] = '^0';
}

public 
show_motd_info(idtarget)
{
static 
name[2][32], killmsg[64];
get_user_name(targetname[0], charsmax(name[]));
new 
minutes = (ttt_get_playerdata(targetPD_KILLEDTIME) / 60) % 60;
new 
seconds ttt_get_playerdata(targetPD_KILLEDTIME) % 60;
ttt_get_kill_message(targetttt_get_playerdata(targetPD_KILLEDBY), killmsgcharsmax(killmsg), 0);

const 
SIZE 1536;
static 
msg[SIZE+1], motdname[64];
new 
lenkilledstate ttt_get_alivestate(target);
if(
killedstate 3)
killedstate 0;

len += formatex(msg[len], SIZE len"<html><head><meta charset='utf-8'><style>body{background:#ebf3f8 url('gfx/ttt/%d.gif') no-repeat center top;}</style></head><body>"killedstate);
len += formatex(msg[len], SIZE len"</br><center><h1>%L %s</h1>"idspecial_names[killedstate], name[0]);
len += formatex(msg[len], SIZE len"<h1>%L</h1>"id"TTT_INFO_LINE3"g_szColors[killedstate], ttt_get_bodydata(targetBODY_TIME));
len += formatex(msg[len], SIZE len"%L <img src='gfx/ttt/%s.gif'></center>"id"TTT_INFO_LINE2"g_szColors[killedstate], minutessecondskillmsg);
len += formatex(msg[len], SIZE len"</body></html>");
formatex(motdnamecharsmax(motdname), "%L"id"TTT_INFO_LINE1");

show_motd(idmsgmotdname);

get_user_name(idname[1], charsmax(name[]));
ttt_log_to_file(LOG_MISC"%s inspected deadbody of %s"name[1], name[0]);
}

public 
show_last_states(id)
{
const 
SIZE 1536;
static 
msg[SIZE+1], show;

if(!
g_iCached[1])
{
new 
len;
len += formatex(msg[len], SIZE len"<html><head><meta charset='utf-8'><style>body{background:#ebf3f8 no-repeat center top;}</style></head><body>");

new 
numplayerplayer_statecount[PLAYER_CLASS];
static 
players[32], name[32];
get_players(playersnum);
for(--
numnum >= 0num--)
{
player players[num];
player_state g_iPlayerStates[player][0];
if(
player_state > -1)
{
count[player_state]++;
get_user_name(playernamecharsmax(name));
len += formatex(msg[len], SIZE len"<b style='color:%s'>[%L] %s</b></br>"g_szColors[player_state], idspecial_names[player_state], name);
}
}

len += formatex(msg[len], SIZE len"</br>");
for(new 
0PLAYER_CLASSi++)
{
if(
count[i])
{
show true;
len += formatex(msg[len], SIZE len"<b style='color:%s'>%L: %d</b></br>"g_szColors[i], idspecial_names[i], count[i]);
}
}

len += formatex(msg[len], SIZE len"</body></html>");
g_iCached[1] = true;
}

if(
show)
show_motd(idmsg"");

Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)