ttt_special_info [Hud Traidor/Detective] [TTT]
#1
Buenas, lo pongo en aporte de codigos ya que es un plugin de tantos que tiene el TTT

Descripcion:
- Fuera de lo que hace normalmente este plugin, le muestra un HUD a los Traidores/Detectives diciendoles los compañeros vivos que tienen o en su defecto que son el unico Traidor/Detective vivo. (Cada uno por su color ROJO/AZUL)

Por mas que sea un aporte le doy los creditos a dos grandes scripters

- CsAxel (Me ayudo en el codigo del HUD)
- ErikMav94 (Idea/Codigo original del HUD)

Link MOD TTT: Trouble in Terrorist Town

Imagenes:

[Imagen: JvGOuk0.png]

Código PHP:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <amx_settings_api>
#include <ttt>

new const g_szDSprite[] = "sprites/ttt/team_d.spr";
new const 
g_szTSprite[] = "sprites/ttt/team_t.spr";

new 
cvar_show_health;
new 
g_iBodyEnts[33], g_iBodyCountFloat:g_fShowTime[33];
new 
g_iStatusSyncg_iKarmaSyncg_pDetectiveSprg_pTraitorSprg_iActiveTarget[33];

// HUD
new g_iHudSync;
new 
pstatesPlayers[129], iHealth[33], sName[33][32], iPlayersiCount

public 
plugin_precache()
{
    new 
sprites[TTT_FILELENGHT];
    if(!
amx_load_setting_string(TTT_SETTINGSFILE"Player Icons""TRAITOR"spritescharsmax(sprites)))
    {
        
amx_save_setting_string(TTT_SETTINGSFILE"Player Icons""TRAITOR"g_szTSprite);
        
g_pTraitorSpr precache_model(g_szTSprite);
    }
    else 
g_pTraitorSpr precache_model(sprites);
    
    if(!
amx_load_setting_string(TTT_SETTINGSFILE"Player Icons""DETECTIVE"spritescharsmax(sprites)))
    {
        
amx_save_setting_string(TTT_SETTINGSFILE"Player Icons""DETECTIVE"g_szDSprite);
        
g_pDetectiveSpr precache_model(g_szDSprite);
    }
    else 
g_pDetectiveSpr precache_model(sprites);
}

public 
plugin_init()
{
    
register_plugin("[TTT] Special player info"TTT_VERSIONTTT_AUTHOR);
    
cvar_show_health my_register_cvar("ttt_show_health""1""Should show health if aimed on player? (Default: 1)");
    
    
register_event("StatusValue""Event_StatusValue_S""be""1=2""2!0");
    
register_event("StatusValue""Event_StatusValue_H""be""1=1""2=0");
    
    
g_iStatusSync CreateHudSyncObj();
    
g_iKarmaSync CreateHudSyncObj();
    
// HUD
    
g_iHudSync CreateHudSyncObj();
}

public 
client_putinserver(id)
{
    
set_task(1.0"show_status"id__"b");
}

public 
client_disconnect(id)
{
    if(
task_exists(id))
        
remove_task(id);
}

public 
ttt_gamemode(gamemode)
{
    if(
gamemode == GAME_ENDED)
    {
        for(new 
0g_iBodyCounti++)
            
g_iBodyEnts[i] = false;
        
g_iBodyCount 0;
    }
}

public 
ttt_spawnbody(ownerent)
{
    
g_iBodyEnts[g_iBodyCount] = ent;
    
g_iBodyCount++;
}

// public client_PostThink(id)
// {
//     if(!is_user_alive(id) || g_fShowTime[id] > get_gametime() || ttt_return_check(id))
//         return;

//     g_fShowTime[id] = get_gametime() + 1.0;
//     new ent = find_dead_body_1d(id, g_iBodyEnts, g_iBodyCount);
//     if(ent)
//     {
//         new target = entity_get_int(ent, EV_INT_iuser1);
//         if(!is_user_connected(target) || is_user_alive(target))
//             return;

//         new R, G = 50, B;
//         static out[64];
//         if(ttt_get_playerdata(target, PD_IDENTIFIED))
//         {
//             new killedstate = ttt_get_playerdata(target, PD_KILLEDSTATE);
//             R = g_iTeamColors[killedstate][0];
//             G = g_iTeamColors[killedstate][1];
//             B = g_iTeamColors[killedstate][2];
//             static name[32];
//             get_user_name(target, name, charsmax(name));
//             formatex(out, charsmax(out), "[%L] %s", id, special_names[killedstate], name);
//         }
//         else
//         {
//             R = 255;
//             G = 222;
//             if(ttt_get_playerstate(id) == PC_TRAITOR)
//                 formatex(out, charsmax(out), "%L --- [%L]", id, "TTT_UNIDENTIFIED", id, special_names[ttt_get_playerdata(target, PD_KILLEDSTATE)]);
//             else formatex(out, charsmax(out), "%L", id, "TTT_UNIDENTIFIED");
//         }

//         g_fShowTime[id] += 1.0;
//         set_hudmessage(R, G, B, -1.0, 0.60, 1, 1.0, 1.3, 0.05, 0.01, -1);
//         ShowSyncHudMsg(id, g_iStatusSync, "%s", out);
//     }
//     else
//     {
//         new body;
//         get_user_aiming(id, ent, body);
//         if(is_valid_ent(ent))
//         {
//             static classname[32];
//             entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));

//             if(equal(classname, TTT_DEATHSTATION) && ttt_get_playerstate(id) == PC_TRAITOR)
//             {
//                 new target = entity_get_int(ent, EV_INT_iuser1);
//                 if(!is_user_connected(target))
//                     return;

//                 g_fShowTime[id] += 1.0;
//                 static name[32];
//                 get_user_name(target, name, charsmax(name));
//                 set_hudmessage(g_iTeamColors[PC_TRAITOR][0], g_iTeamColors[PC_TRAITOR][1], g_iTeamColors[PC_TRAITOR][2], -1.0, 0.60, 1, 1.0, 1.3, 0.01, 0.01, -1);
//                 ShowSyncHudMsg(id, g_iStatusSync, "%s --- [%L]", name, id, "TTT_ITEM_ID8");
//             }
//         }
//     }
// }

public Event_StatusValue_S(id)
{
    if(!
is_user_connected(id))
        return;
    
    new 
mode ttt_get_gamemode();
    if(
mode != GAME_STARTED && mode != GAME_PREPARING)
        return;
    
    static 
message[128], name[32], loyalties[32];
    new 
target read_data(2);
    
    new 
targetState ttt_get_playerstate(target), idState ttt_get_playerstate(id), useState;
    new 
fakeState ttt_get_playerdata(targetPD_FAKESTATE);
    if(
fakeState && targetState != idState)
        
targetState fakeState;
    
    if(
targetState == PC_DETECTIVE)
        
useState PC_DETECTIVE;
    else if(
targetState == PC_TRAITOR && idState == PC_TRAITOR)
        
useState PC_TRAITOR;
    else 
useState PC_INNOCENT;
    
    if(
mode == GAME_PREPARING)
    {
        
targetState PC_INNOCENT;
        
useState PC_INNOCENT;
    }
    
    new 
loyalty ttt_get_playerdata(targetPD_LOYALTY);
    if(
loyalty)
        
formatex(loyaltiescharsmax(loyalties), "[%L]"idplayer_loyalty[loyalty]);
    else 
loyalties "";
    
    new 
g_iTeamColors[useState][0];
    new 
g_iTeamColors[useState][1];
    new 
g_iTeamColors[useState][2];
    
    new 
karma ttt_get_playerdata(targetPD_KARMA);
    
set_hudmessage(RGB, -1.00.6010.013.00.010.01, -1);
    
remove_special_sprite(idg_iActiveTarget[id]);
    
    
ttt_get_user_name(targetnamecharsmax(name));
    if(
get_pcvar_num(cvar_show_health))
        
formatex(messagecharsmax(message), "%s %s -- [Karma = %d] [HP = %d]"loyaltiesnamekarmaget_user_health(target));
    else 
formatex(messagecharsmax(message), "%s %s -- [Karma = %d]"loyaltiesnamekarma);
    
    if((
idState == PC_INNOCENT || idState == PC_DETECTIVE) && targetState != PC_DETECTIVE)
    {
        if(!
ttt_get_playerdata(targetPD_HIDENAME))
            
ShowSyncHudMsg(idg_iStatusSync"%s"message);
    }
    else if(
target != g_iActiveTarget[id])
    {
        if(
mode == GAME_PREPARING || mode == GAME_OFF)
            
ShowSyncHudMsg(idg_iStatusSync"%s"message);
        else 
        {
            
format(messagecharsmax(message), "[%L] %s"idspecial_names[targetState], message);
            
ShowSyncHudMsg(idg_iStatusSync"%s"message);
        }
        
        if(
targetState == PC_DETECTIVE)
            
show_special_sprite(idtargetPC_DETECTIVE);
        else if(
targetState == PC_TRAITOR && idState == PC_TRAITOR)
            
show_special_sprite(idtargetPC_TRAITOR);
    }
    
    
g_iActiveTarget[id] = target;
}

public 
Event_StatusValue_H(id)
{
    
ClearSyncHud(idg_iStatusSync);
    
remove_special_sprite(idg_iActiveTarget[id]);
}

public 
show_special_sprite(idtargetwhich)
{
    if(!
is_user_connected(id) || !is_user_connected(target))
        return;
    
    
message_begin(MSG_ONESVC_TEMPENTITY_id);
    
write_byte(TE_PLAYERATTACHMENT);
    
write_byte(target);
    
write_coord(45);
    if(
which == PC_TRAITOR)
        
write_short(g_pTraitorSpr);
    else if(
which == PC_DETECTIVE)
        
write_short(g_pDetectiveSpr);
    
write_short(30);
    
message_end();
}

public 
remove_special_sprite(idtarget)
{
    if(!
is_user_connected(id) || !is_user_connected(target))
        return;
    
    
message_begin(MSG_ONESVC_TEMPENTITY_id);
    
write_byte(TE_KILLPLAYERATTACHMENTS);
    
write_byte(target);
    
message_end();
    
    
g_iActiveTarget[id] = 0;
}

public 
show_status(alive)
{
    new 
dead alive;
    if(!
is_user_alive(dead))
    {
        
alive entity_get_int(deadEV_INT_iuser2);
        if(!
is_user_alive(alive))
            return;
    }
    
    new 
RGB;
    new 
aliveState ttt_get_playerstate(alive), deadState ttt_get_playerstate(dead);
    if(
deadState == PC_DEAD || deadState == PC_NONE)
    {
        
g_iTeamColors[deadState][0];
        
g_iTeamColors[deadState][1];
        
g_iTeamColors[deadState][2];
    }
    else
    {
        
g_iTeamColors[aliveState][0];
        
g_iTeamColors[aliveState][1];
        
g_iTeamColors[aliveState][2];
    }
    
    
set_hudmessage(RGB0.020.906.01.10.00.0, -1);
    new 
karma ttt_get_playerdata(alivePD_KARMA);
    
    static 
loyalties[32];
    new 
loyalty ttt_get_playerdata(alivePD_LOYALTY);
    if(
loyalty)
        
formatex(loyaltiescharsmax(loyalties), "[%L]"aliveplayer_loyalty[loyalty]);
    else 
loyalties "";
        
    if(
deadState == PC_DEAD || deadState == PC_NONE)
        
ShowSyncHudMsg(deadg_iKarmaSync"%s [Karma = %d]"loyaltieskarma);
    else if(
aliveState != PC_DETECTIVE && aliveState != PC_TRAITOR)
        
ShowSyncHudMsg(aliveg_iKarmaSync"%s [Karma = %d] [%L]"loyaltieskarmaalivespecial_names[aliveState]);
    else
    {
        
ShowSyncHudMsg(aliveg_iKarmaSync"%s [Karma = %d] [%L] [Credits = %d]"loyaltieskarmaalivespecial_names[aliveState], ttt_get_playerdata(alivePD_CREDITS));
        
info_ttt_mod(alive);
        
set_hudmessage(g_iTeamColors[pstate][0], g_iTeamColors[pstate][1], g_iTeamColors[pstate][2], 0.30.1206.01.10.10.1, -1);
        if(!
iCount)
            
ShowSyncHudMsg(aliveg_iHudSync"Eres el unico %L vivo !"alivespecial_names[pstate]);
        else
            
ShowSyncHudMsg(aliveg_iHudSync"Tienes %d compañero%s vivo%s:^n^n%s"iCountiCount "s" ""iCount "s" ""sPlayers); 
    }
}

public 
info_ttt_mod(id)
{
    
pstate ttt_get_playerstate(id);
    if (!
is_user_alive(id))
        return;
    
    new 
len 0;
    
iCount 0;
    for (
iPlayers 1iPlayers <= get_maxplayers(); iPlayers++)
    {
        if (!
is_user_alive(iPlayers) || id == iPlayers
            continue;
        
        if((
pstate == PC_DETECTIVE && ttt_get_playerstate(iPlayers) == PC_DETECTIVE && ttt_get_playerstate(iPlayers) != PC_TRAITOR
        || (
pstate == PC_TRAITOR && ttt_get_playerstate(iPlayers) == PC_TRAITOR && ttt_get_playerstate(iPlayers) != PC_DETECTIVE))
        {
            
iHealth[iPlayers] = get_user_health(iPlayers);
            
get_user_name(iPlayerssName[iPlayers], charsmax(sName[]));
        
            
iCount++;

            
len += formatex(sPlayers[len], charsmax(sPlayers) - len"%s [HP: %d]^n"sName[iPlayers], iHealth[iPlayers]); 
        }
    }


Lo unico que tendrian que fijarse es la posicion X e Y del HUD

Código PHP:
et_hudmessage(g_iTeamColors[pstate][0], g_iTeamColors[pstate][1], g_iTeamColors[pstate][2], 0.30.1206.01.10.10.1, -1); 

ese....

- Voy a seguir aportando codigos de TTT ya que no veo tanto y ademas está bueno el MOD y nos ahorrariamos 20 threads con la misma pregunta

Saludos.
Responder
#2
copión Whatever

[Imagen: JvGOuk0.png]

si te sirve, es la única que tengo
Responder
#3
Código PHP:
iCount++;
            
            if (
iCount)
                
add(sPlayerscharsmax(sPlayers), "^n"); 

Dafuq
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes
.
Responder
#4
Che alguien me ayuda con esto?, me aparece error al crear len, y aparte cuando creas len en el hud se crean asi los players

duraznito[100hp]
xd[100hp]
duraznito[100hp]
xd[100hp]
duraznito[100hp]
xd[100hp]
duraznito[100hp]
xd[100hp]
duraznito[100hp]
xd[100hp]
duraznito[100hp]
xd[100hp]

y asi repitiendose
Responder
#5
Quien me dice, como arreglar este error?

Cita:Warning: Symbol "client_disconnect" is marked as deprecated: Use client_disconnected() instead. on line 56

Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Too many error messages on one line on line 317

Compilation aborted.
4 Errors.
[Imagen: 76561198086476173.png]
Responder
#6
(16/03/2016, 02:10 PM)joluis81 escribió: Quien me dice, como arreglar este error?

Cita:Warning: Symbol "client_disconnect" is marked as deprecated: Use client_disconnected() instead. on line 56

Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Too many error messages on one line on line 317

Compilation aborted.
4 Errors.

crea una variable llamada "len" tanto misterio no tiene Genius
Responder
#7
(16/03/2016, 02:10 PM)joluis81 escribió: Quien me dice, como arreglar este error?

Cita:Warning: Symbol "client_disconnect" is marked as deprecated: Use client_disconnected() instead. on line 56

Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Too many error messages on one line on line 317

Compilation aborted.
4 Errors.

me pasa lo mismo, no se como hacerlo Roflmao
Responder
#8
(27/03/2016, 10:19 PM)Boligoma escribió:
(16/03/2016, 02:10 PM)joluis81 escribió: Quien me dice, como arreglar este error?

Cita:Warning: Symbol "client_disconnect" is marked as deprecated: Use client_disconnected() instead. on line 56

Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Too many error messages on one line on line 317

Compilation aborted.
4 Errors.

me pasa lo mismo, no se como hacerlo Roflmao

Dios santo.. Fijense en la ultima funcion eliminen todo el public y pongan este
Código PHP:
public info_ttt_mod(id)
{
    
pstate ttt_get_playerstate(id);
    if (!
is_user_alive(id))
        return;
    
    new 
len 0;
    
iCount 0;
    for (
iPlayers 1iPlayers <= get_maxplayers(); iPlayers++)
    {
        if (!
is_user_alive(iPlayers) || id == iPlayers
            continue;
        
        if((
pstate == PC_DETECTIVE && ttt_get_playerstate(iPlayers) == PC_DETECTIVE && ttt_get_playerstate(iPlayers) != PC_TRAITOR
        || (
pstate == PC_TRAITOR && ttt_get_playerstate(iPlayers) == PC_TRAITOR && ttt_get_playerstate(iPlayers) != PC_DETECTIVE))
        {
            
iHealth[iPlayers] = get_user_health(iPlayers);
            
get_user_name(iPlayerssName[iPlayers], charsmax(sName[]));
        
            
iCount++;

            
len += formatex(sPlayers[len], charsmax(sPlayers) - len"%s [HP: %d]^n"sName[iPlayers], iHealth[iPlayers]); 
        }
    }

Responder
#9
(27/03/2016, 10:19 PM)Boligoma escribió:
(16/03/2016, 02:10 PM)joluis81 escribió: Quien me dice, como arreglar este error?

Cita:Warning: Symbol "client_disconnect" is marked as deprecated: Use client_disconnected() instead. on line 56

Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Undefined symbol "len" on line 317
Error: Too many error messages on one line on line 317

Compilation aborted.
4 Errors.

me pasa lo mismo, no se como hacerlo Roflmao

Lo vi hace unos dias y lo arreglé, nose que habré tocado en su momento jaja
Responder
#10
Quiero Un Plugins de Lasertripmin y Un De Weapon de Survivors Aguien amable que me pudiera ayudar se lo agradeceria Sonrisa

Hola Como estan todo disculpa mi pregunta es la siguientes "COMO PUEDO COSEGUIR 2 PLUGINS GRATIS"
El Primero es ---> Como agregarle mas armas al survivor en Cs Zombie plague advance 1.6.1 "Osea solo quiero que cuando convoque la partida en modo survivor vs zombie el tenga 3 armas primarias"
estas son las armas que me gustaria que fueran las preimarias
weapon_ak47
weapon_m4a1
weapon_xm1014

El Segundo es ---> Quiero un plugins de larsermine como la que usan en los server una que tenga forma de bio trimine y que la vida de la mina sea visible arriba a la izquierdad de la pantalla y cuando explote le quite vida a los zombie dependiendo de que tan serca allan estado de la explocion "Que ganen ammon dependiendo de la cantida de vida que le quito o pego al zombie en la explocion " ademas de eso quiro que tenga un aura de color azul claro e lo mas importante que al matar un zombie con la mina gane 2 de ammon pack "Que Se Compre con ammonpack y que al dispararle con un arma o al pegarle con un cuchillo le baje la vida hasta explotar.

Tambie quiero que se ponga con esto comando "bind "La letra que uno se sienta mas comodo " +setlaser <--- Para ponerla
bind "La Letra .." +Dellaser <--- Quitarla

Porfavor ayudenme con ese problemita porvafor e intentado descargar todo los plugins visto en la paguina de las minas pero niguno coinside y ademas e encotrado plugins que no funciona "A YUDENMEN " (SONRRY)
La Vida Es Como Una Càmara:
Sòlo Enfòcate En Lo Que Es Importante, Captura Los buenos Momentos, Saca De Lo Negativo Un Aprendizaje Revelado, Si Las Cosas No Salen Como Lo Deseabas, Intenta Una Nueva Toma.
Responder
#11
(28/03/2017, 02:03 PM)Robinson escribió: Quiero Un Plugins de Lasertripmin y Un De Weapon de Survivors Aguien amable que me pudiera ayudar se lo agradeceria Sonrisa

Hola Como estan todo disculpa mi pregunta es la siguientes "COMO PUEDO COSEGUIR 2 PLUGINS GRATIS"
El Primero es ---> Como agregarle mas armas al survivor en Cs Zombie plague advance 1.6.1 "Osea solo quiero que cuando convoque la partida en modo survivor vs zombie el tenga 3 armas primarias"
estas son las armas que me gustaria que fueran las preimarias
weapon_ak47
weapon_m4a1
weapon_xm1014

El Segundo es ---> Quiero un plugins de larsermine como la que usan en los server una que tenga forma de bio trimine y que la vida de la mina sea visible arriba a la izquierdad de la pantalla y cuando explote le quite vida a los zombie dependiendo de que tan serca allan estado de la explocion "Que ganen ammon dependiendo de la cantida de vida que le quito o pego al zombie en la explocion " ademas de eso quiro que tenga un aura de color azul claro e lo mas importante que al matar un zombie con la mina gane 2 de ammon pack "Que Se Compre con ammonpack y que al dispararle con un arma o al pegarle con un cuchillo le baje la vida hasta explotar.

Tambie quiero que se ponga con esto comando "bind "La letra que uno se sienta mas comodo " +setlaser <--- Para ponerla
bind "La Letra .." +Dellaser <--- Quitarla

Porfavor ayudenme con ese problemita porvafor e intentado descargar todo los plugins visto en la paguina de las minas pero niguno coinside y ademas e encotrado plugins que no funciona "A YUDENMEN " (SONRRY)

Para eso esta la sección pedido de plugins.
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)