22/04/2021, 06:05 PM
(Última modificación: 22/04/2021, 06:05 PM por MalitoMaloso.)
tengo problema con este plugins que no se como se abre el menu o si sale solo o no es del modo rangos de ttt
nose si se puede dejar con la letra N que les salga el menu si es que hay para que alguien pueda revisar este plugins porfa
nose si se puede dejar con la letra N que les salga el menu si es que hay para que alguien pueda revisar este plugins porfa
Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <dhudmessage>
#include <adv_vault>
#include <ttt>
#define MAX_RANGES 48
#define TASK_HUD 5689
#define ID_HUD (taskid - TASK_HUD)
#define CostLvlUp(%1) (%1 * %1 * 40)
#define EXP_POR_KILL 1
new const PluginInfoJD[][] ={ "[TTT] System Rangos","1.0b","Juan' Diego'","!g[!tTTT!g]!n "};
new g_vault;
new saytex;
new teaminfo;
new screefade;
new maxplayers;
new rango[33];
new exp[33];
new randomkill[33];
new puntosA[33];
new Ganancias[33];
new happyhours;
new CommandMenuID;
new synchud;
new cvar_karma_minimo,cvar_ban_time,cvar_puntos_kill;
enum {
RANGO,
EXP,
RKS,
PUNTOS,
DATA_RANGOS
};
enum _:WPN {
WPN_NAME[ 30 ],
WPN_ENT[ 20 ],
WPN_CSW,
WPN_COST
}
new g_campo[DATA_RANGOS];
new const Happy_Hour_Time[][] ={ "12", "20", "24", "06" };
new const Rangos[][] =
{ "***",
"Recien llegado",
"Civil",
"Civil elite",
"Civil Master",
"Rker",
"Pistolero",
"Comandante",
"Comandante Master",
"Francotirador",
"Cazador de Traidores",
"El Cazador De inocentes",
"Assesino de Detectives",
"Exterminador De Traidores",
"Dectetive I",
"Dectetive II",
"Dectetive II",
"Dectetive Guardian I",
"Inocente Guardian II",
"Inocente Guardian Elite",
"Inocente Master I",
"Inocente Master II",
"Traidor Eagle Master",
"Traidor Eagle Master II",
"Traidor De Traidores",
"Rker Inocente",
"Rker Detective",
"Rker Traidor",
"Agente del FBI",
"Arabe Jihad",
"Allhu Akbar",
"Rambo Inocente",
"Rambo Detective",
"Rambo Traidor",
"Scarface Master",
"Scarface Guardian Elite",
"Presidente Obama",
"Osama Bin Laden",
"Traidor Infiltrado",
"Capitan Traidor",
"Genera Inocente",
"Rey De Inocente",
"Esclavo Traidor",
"El Cazador Del Rando Kill",
"The Global Traidor I",
"The Global Traidor II",
"The Global Traidor II",
"Bug Fix :v"
};new const WeaponPri[ ][ WPN ] =
{
///name - weaponid --- weaponCSW -- weapon price
{ "M3 Super", "weapon_m3", CSW_M3, 5 },
{ "Mp5 Navy", "weapon_mp5navy", CSW_MP5NAVY, 5},
{ "Famas", "weapon_famas", CSW_FAMAS, 5},
{ "Galil", "weapon_galil", CSW_GALIL, 20 },
{ "AUG", "weapon_aug", CSW_AUG, 20 },
{ "SG - 552", "weapon_sg552", CSW_SG552, 20},
{ "AWP MAGNUM", "weapon_awp", CSW_AWP, 50 },
{ "M4A1", "weapon_m4a1", CSW_M4A1, 55 },
{ "AK - 47 Kalashnikov", "weapon_ak47", CSW_AK47, 100},
{ "SG - 550", "weapon_sg550", CSW_SG550, 100 },
{ "G3SG1", "weapon_sg3sg1", CSW_G3SG1, 100},
{ "M249 - Machine Gun", "weapon_m249", CSW_M249,100 }
};
new const WeaponSec[ ][ WPN ] =
{
{ "Glock", "weapon_glock18", CSW_GLOCK18, 3 },
{ "USP", "weapon_usp", CSW_USP, 3 },
{ "P228", "weapon_p228", CSW_P228, 4 },
{ "Deaglee", "weapon_deagle", CSW_DEAGLE, 10 },
{ "Fiveseven", "weapon_fiveseven", CSW_FIVESEVEN, 5 },
{ "Dual Elite", "weapon_elite", CSW_ELITE, 8 }
};
public plugin_init()
{
register_plugin(PluginInfoJD[0], PluginInfoJD[1], PluginInfoJD[2]);
register_logevent("lev_RoundEnd", 2, "1=Round_End");
RegisterHam( Ham_Spawn , "player" , "ham_PlayerSpawnpost" , true );
RegisterHam(Ham_Killed, "player", "ham_PlayerKilledPost", true);
register_clcmd("say" ,"msg_say");
cvar_karma_minimo = my_register_cvar("Karma minimo","350","Karma minimo de ban (-350)");
cvar_ban_time = my_register_cvar("Tiempo ban","20","tiempo de banamex :v (20)");
cvar_puntos_kill = my_register_cvar("Puntos x kill","5","puntos por kill (5)");
CommandMenuID = ttt_command_add("Tienda Admin\r(\dArmamento Especial\r)");
saytex = get_user_msgid( "SayText" );
teaminfo = get_user_msgid( "TeamInfo" );
screefade = get_user_msgid("ScreenFade");
maxplayers = get_maxplayers();
synchud = CreateHudSyncObj();
register_forward(FM_ClientUserInfoChanged, "fw_clientinfo_changed");
g_vault = adv_vault_open("vaultrangos", false);
g_campo[RANGO] = adv_vault_register_field(g_vault,"RANGO");
g_campo[EXP] = adv_vault_register_field(g_vault,"EXP");
g_campo[RKS] =adv_vault_register_field(g_vault,"RKS");
g_campo[PUNTOS] = adv_vault_register_field(g_vault,"PUNTOS");
adv_vault_init(g_vault);
}
public ttt_command_selected(id, menuid, name[])
{
if(CommandMenuID == menuid)
cmd_menu(id);
}
public client_putinserver(id)
{
rango[id] = 1;
exp[id] = 0;
randomkill[id]=0;
puntosA[id]=0;
Vault(id,1);
if(!is_user_bot(id))set_task( 1.0, "hud_stats", id + TASK_HUD, _, _, "b" );
}
public client_disconnect(id)
{
Vault(id,2);
remove_task(id);
remove_task( id + TASK_HUD );
}
public fw_clientinfo_changed(id, buffer)
{
if(is_user_connected(id))
{
static OldName[33];
engfunc(EngFunc_InfoKeyValue, buffer, "name", OldName, sizeof OldName - 1);
if(equal(OldName,ttt_get_name(id)))
return FMRES_IGNORED;
set_user_info(id, "name", ttt_get_name(id));
client_cmd(id, "setinfo ^"name^" ^"%s^"",ttt_get_name(id));
Color_Print(id,"No te pues Cambiar el Nombre dentro del !gServidor !t:v");
}
return FMRES_IGNORED;
}
public Vault(id,Guardar_Cargar)
{
if(Guardar_Cargar == 1)
{
///Cargar
if(!adv_vault_get_prepare(g_vault, _,ttt_get_name(id)))return;
else
{
rango[id] = adv_vault_get_field(g_vault, g_campo[RANGO]);
exp[id]= adv_vault_get_field(g_vault, g_campo[EXP]);
randomkill[id] = adv_vault_get_field(g_vault,g_campo[RKS]);
puntosA[id] = adv_vault_get_field(g_vault,g_campo[PUNTOS]);
}
}
else if(Guardar_Cargar==2)
{
//Guardar
adv_vault_set_start(g_vault);
adv_vault_set_field(g_vault, g_campo[RANGO],rango[id]);
adv_vault_set_field(g_vault, g_campo[EXP],exp[id]);
adv_vault_set_field(g_vault,g_campo[RKS],randomkill[id]);
adv_vault_set_field(g_vault,g_campo[PUNTOS],puntosA[id]);
adv_vault_set_end(g_vault, 0, ttt_get_name(id));
}
}
public ham_PlayerKilledPost(Victim, Attacker, Shouldgib)
{
if(!is_user_connected( Attacker ) || Victim == Attacker ||! Attacker )return;
if(is_user_alive(Attacker))
{
new state_killer = ttt_get_playerstate(Attacker), state_victim = ttt_get_playerdata(Victim, PD_KILLEDSTATE);
if(state_killer == PC_TRAITOR && state_victim == PC_TRAITOR || state_killer == PC_DETECTIVE && state_victim == PC_DETECTIVE
|| state_killer == PC_INNOCENT && state_victim == PC_DETECTIVE || state_killer == PC_INNOCENT && state_victim == PC_INNOCENT
|| state_killer == PC_DETECTIVE && state_victim == PC_INNOCENT )
{
if(is_user_admin(Victim))
{
if(puntosA[Attacker] >0)
{
puntosA[Attacker]-=1;
}
}
++randomkill[Attacker];
Color_Print(Attacker, "^4No ganas ^3EXP, ^4por hacer ^3Random kill ^4papu :v." );
set_castigo(Attacker);
return;
}
if(is_user_admin(Attacker))
{
puntosA[Attacker]+=get_pcvar_num( cvar_puntos_kill);
}
set_exp( Attacker, EXP_POR_KILL );
}
}
public ham_PlayerSpawnpost(id)
{
if(!is_user_connected(id) &&!is_user_alive(id))return;
new num;
static players[32];
get_players(players,num);
if(num>3)// Si ay mas de 3 player conectados mandamos el TASK
set_task(10.1,"karma_ban",id);
}
public hud_stats( taskid )
{
static index; index = ID_HUD;
if (!is_user_alive( index ))
{
index = pev( index, pev_iuser2 );
if (!is_user_alive( index )) return;
}
if(index != ID_HUD)
{
//set_hudmessage(0,255,0, 0.60, 0.67, 1, 6.0, 1.0);
set_hudmessage(255, 0, 0, 0.0, 0.20, 1, 6.0, 1.0);
ShowSyncHudMsg(ID_HUD,synchud,"^n^n^nRango: %s^nExp: %d^nRandom Kills: %d", Rangos[ rango[index] ],exp[ index],randomkill[index]);
}
else
{
set_hudmessage(0, 255, 0, 0.0, 0.20, 1, 6.0, 1.0);
ShowSyncHudMsg(ID_HUD,synchud,"[ TTT Rangos System¬¬ ]^n^nRango: %s^nexp: %d | %d^nRandom Kills: %d^nGanancia: x%d",
Rangos[ rango[index] ], exp[ index ], CostLvlUp(rango[index]),randomkill[index],Ganancias[index]);
}
if(is_user_admin(index))
{
set_hudmessage(0, 70, 200, -1.0, 0.0, 0, 0.5, 2.0, 0.08, 2.0);
ShowSyncHudMsg(ID_HUD,synchud,"^n^nTus Puntos : %d",puntosA[index]);
}
}
set_exp( id, experience )
{
if( !is_user_connected( id ) || !experience ) return;
if( (exp[ id ] + experience) > CostLvlUp( MAX_RANGES ))
{
exp[ id ] = CostLvlUp( MAX_RANGES );
Color_Print( id, "^4Ya alcanzaste el maximo de ^3exp papu :v" );
return;
}
exp[ id] += (experience*Ganancias[id]);
static lvl; lvl = rango[ id ];
while( exp[ id ] >= CostLvlUp(rango[ id ]) && rango[ id] < MAX_RANGES )
++rango[ id];
if(rango[ id] > lvl )
{
Color_Print( id, "!tFelicidades has Subido al !gRango: !n'%s'", Rangos[rango[ id] ] );
}
Vault(id,2);
}
public set_castigo(id)
{
set_dhudmessage(255, 85, 0, -1.0, -1.0, 0, 6.0, 12.0);
show_dhudmessage(id, "[TTT] Random kill, Ten Cuidado!!!");
set_user_health(id, get_user_health(id) - 50);
Set_user_screenfade(id, 255, 0, 0, 2, 100);
shake_user_screen(id);
}
public karma_ban(id)
{
if(ttt_get_playerdata(id,PD_KARMA) <= get_pcvar_num( cvar_karma_minimo )) // Si El Karma del Cliente es <= menor al que esta definido por Cvar
{
new ip[35]; get_user_ip(id,ip,34);
server_cmd("kick #%d ^"Karma Negativo :v BANAMEXX (%d Mins)^";wait;banip ^"%s^" ^"%s^";wait;writeid", get_user_userid( id),get_pcvar_num( cvar_ban_time ),ip,get_pcvar_num( cvar_ban_time ));
Color_Print(0,"El Usuario !g'%s'!n Fue Baneado !g'%d' Minutos!n RAZON:!g Karma Negativo ",ttt_get_name(id),get_pcvar_num( cvar_ban_time ));
}
return PLUGIN_HANDLED;
}
/***********************************************************************/
/* MENUS */
/**********************************************************************/
public cmd_menu( id )
{
if(!is_user_admin(id))return;
new menu = menu_create( "\y[ \dTTT \y] \wArmamento", "menu_armas" );
menu_additem( menu, "Armas Primarias", "1" );
menu_additem( menu, "Armas Secundarias", "2" );
menu_display( id, menu );
}
public menu_armas( id, menu, item )
{
if(item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
switch ( item )
{
case 0: PriMenu( id );
case 1: SecMenu( id );
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}
public PriMenu(id)
{
new i, wpn[50], menu = menu_create( "\y[ \dTTT \y] \wArmamento Primario", "menu_pri" );
for( i = 0; i < sizeof WeaponPri ; ++i )
{
if( puntosA[id] >= WeaponPri[ i ][ WPN_COST ])
{
formatex( wpn, charsmax(wpn), "\w%s \y[ \r%d Puntos \y]", WeaponPri[ i ][ WPN_NAME ], WeaponPri[ i ][ WPN_COST ] );
menu_additem( menu, wpn, "");
}
else
{
formatex( wpn, charsmax(wpn), "\d%s \y[ \r%d Puntos \y]", WeaponPri[ i ][ WPN_NAME ], WeaponPri[ i ][ WPN_COST ] );
menu_additem( menu, wpn, "" );
}
}
menu_display( id, menu ,0);
}
public SecMenu(id )
{
new i, wpn[50], menu = menu_create( "\y[ \dTTT \y] \wArmamento Secundario", "menu_sec" );
for( i = 0; i < sizeof WeaponSec ; ++i )
{
if( puntosA[id] >= WeaponSec[ i ][ WPN_COST ])
{
formatex( wpn, charsmax(wpn), "\w%s \y[ \r%d Puntos \y]", WeaponSec[ i ][ WPN_NAME ], WeaponSec[ i ][ WPN_COST ] );
menu_additem( menu, wpn, "");
}
else
{
formatex( wpn, charsmax(wpn), "\d%s \y[ \r%d Puntos \y]", WeaponSec[ i ][ WPN_NAME ], WeaponSec[ i ][ WPN_COST ] );
menu_additem( menu, wpn, "" );
}
}
menu_display( id, menu,0 );
}
public menu_sec( id, menu, item )
{
if(item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
if( puntosA[id] < WeaponSec[ item ][ WPN_COST ])
{
Color_Print( id, "No tienes suficientes puntos");
cmd_menu(id);
return PLUGIN_HANDLED;
}
give_item( id, WeaponSec[ item ][ WPN_ENT ]);
cs_set_user_bpammo( id, WeaponSec[ item ][ WPN_CSW ], 999 );
puntosA[id] -= WeaponSec[ item ][ WPN_COST ];
Color_Print(id,"Comprastes !g%s !tArma",WeaponSec[item][WPN_NAME]);
menu_destroy( menu );
return PLUGIN_HANDLED;
}
public menu_pri( id, menu, item )
{
if(item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
if( puntosA[id] < WeaponPri[ item ][ WPN_COST ])
{
Color_Print(id, "No tienes suficientes puntos");
cmd_menu(id);
return PLUGIN_HANDLED;
}
give_item( id, WeaponPri[ item ][ WPN_ENT ]);
cs_set_user_bpammo( id, WeaponPri[ item ][ WPN_CSW ], 999 );
puntosA[id] -= WeaponPri[ item ][ WPN_COST ];
Color_Print(id,"Comprastes !g%s !tArma",WeaponPri[item][WPN_NAME]);
menu_destroy( menu );
return PLUGIN_HANDLED;
}
/**************************************************************************************/
public lev_RoundEnd()
{
get_happytime();
for(new i = 1; i <= maxplayers; ++i)
{
if(!is_user_connected(i)) continue;
Vault(i,2);
if(happyhours)hhhours(i);
}
}
Ganancia( id )
{
if( is_user_admin(id))
{
if(happyhours)
{
Ganancias[id] = 3;
}
else
{
Ganancias[id] = 2;
}
}
else
{
if(happyhours)
{
Ganancias[id] = 2;
}
else
{
Ganancias[id] = 1;
}
}
}
get_happytime()
{
happyhours = false;
static timeh[3], hour, id;
get_time("%H", timeh, charsmax(timeh));
for(hour = 0; hour < sizeof Happy_Hour_Time; ++hour)
{
if(equal(timeh, Happy_Hour_Time[hour]))
happyhours = true;
}
for(id = 1; id <= maxplayers; ++id)
{
if(!is_user_connected(id)) return;
Ganancia(id);
}
}
public msg_say( id )
{
static said[191];
read_args(said, charsmax(said)); remove_quotes(said);
replace_all(said, charsmax(said), "%", ""); replace_all(said, charsmax(said), "#", "");
if (!ValidMessage(said, 1)) return PLUGIN_CONTINUE;
static color[11], prefix[91];
get_user_team(id, color, charsmax(color));
formatex(prefix, charsmax(prefix), "%s^x01[^x04%s^x01]^x03 %s", is_user_alive(id)?"^x01":"^x01*MUERTO* ",Rangos[ rango[ id]], ttt_get_name(id));
if (is_user_admin(id)) format(said, charsmax(said), "^x04%s", said);
format(said, charsmax(said), "%s^x01 : %s", prefix, said);
static i, team[11];
for (i = 1; i <= maxplayers; ++i)
{
if (!is_user_connected( i )) continue;
if (is_user_alive( id) && is_user_alive( i ) || !is_user_alive( id ) && !is_user_alive( i ))
{
get_user_team(i, team, charsmax(color));
changeTeamInfo(i, color);
writeMessage(i, said);
changeTeamInfo(i, team);
}
}
return PLUGIN_HANDLED_MAIN;
}
public changeTeamInfo(player, team[])
{
message_begin(MSG_ONE,teaminfo, _, player);
write_byte(player);
write_string(team);
message_end();
}
public writeMessage(player, message[])
{
message_begin(MSG_ONE, saytex, {0, 0, 0}, player);
write_byte(player);
write_string(message);
message_end();
}
stock ValidMessage(text[], maxcount)
{
static len, i, count;
len = strlen(text);
count = 0;
if (!len) return false;
for (i = 0; i < len; ++i)
{
if (text[i] != ' ')
{
++count;
if (count >= maxcount)
return true;
}
}
return false;
}
public hhhours(id)
{
Color_Print(id,"La Happy'Hours Esta:!g %s!t Tu Ganancia: !gx%d !tde !gEXP",happyhours? "Activada" : "Desactivada",Ganancias[id]);
}
ttt_get_name(id)
{
static Name[ 32 ];
get_user_name( id, Name, charsmax( Name ) );
return Name;
}
stock Color_Print(const id, const input[], any:...)
{
new count = 1, players[32];
static msg[191], len;
len = formatex(msg, charsmax(msg), "%s ", PluginInfoJD[3]);
vformat(msg[len], 190 - len, input, 3);
replace_all(msg, 190, "!g", "^4");
replace_all(msg, 190, "!n", "^1");
replace_all(msg, 190, "!t", "^3");
if(id)
players[0] = id;
else
get_players(players, count, "ch");
for (new i = 0; i < count; ++i)
if(is_user_connected(players[i]))
{
{
message_begin(MSG_ONE_UNRELIABLE, saytex, _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
public Set_user_screenfade(index, rrr, ggg, bbb, duracion, alpha)
{
message_begin( index ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, screefade, _, index );
write_short( duracion * 4096 );
write_short( duracion * 4096 );
write_short( 0x0000 );
write_byte( rrr );
write_byte( ggg );
write_byte( bbb );
write_byte( alpha );
message_end( );
}
stock shake_user_screen(index)
{
message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, index); // Shake Screen
write_short(1<<14);
write_short(1<<14);
write_short(1<<14);
message_end();
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par }
*/