23/09/2018, 07:57 PM
Ayua necesito hacer eso del titulo aqui esta ya con chat color y adrenalina falta ponerle el menu de cuchillos por rango
Código PHP:
/* -----------------------------------------
Creditos: Solo para Raulitop, por el hook say :3
Version Con Guardado NFVAULT
------------------------------- */
#include <amxmisc>
#include <fakemeta>
#include <nfvault>
#include <jctf>
new const PLUGIN[] = "Rangos CS:GO"
#define VERSION "1.0"
new const AUTHOR[] = "kikizon"
/* =============================================
|= [EMPIEZA SECCION MODIFICABLE] =|
==============================================*/
/* ====================================
*[CONSTANTES]*
=====================================*/
new const Web[] = "www.tunserver.com.ve" // Se Muestra en HUD
new const Prefijo[] = "!g(!y|!g->!tFox!g<-!y|!g)!y" // Prefijo en say
new const Sonido[] = "FOXSOUND_CTF/up.wav" // Sonido Rango UP
new Flags;
new g_AdminTag[33][10]
enum _:Data {
TAG[10],
FLAG
}
new const AdminsTags[][Data] = {
{ "DUEÑO", ADMIN_RCON },
{ "[SOCIO]", ADMIN_IMMUNITY },
{ "[ADMIN]", ADMIN_KICK },
{ "[SPAMERO]", ADMIN_RESERVATION }
}
/* ====================================
*[CONST NOMBRES DE RANGOS]*
=====================================*/
enum _:DATA
{
NOMBRE[30],
FRAGS
}
new const Rangos[][DATA] = {
{ "Novato", 100 },
{ "Amateur", 200 },
{ "Amateur II", 300 },
{ "Semi PRO", 500 },
{ "Semi PRO II", 700 },
{ "Semi PRO III", 800 },
{ "PRO", 900 },
{ "PRO II", 1000 },
{ "PRO Gold", 1200 },
{ "Semi FOX ", 1300 },
{ "Semi FOX II", 1400 },
{ "FOX COMPLETE ",1500 },
{ "FOX COMPLETE II", 1700 },
{ "FOX LEGEDNARIO", 1800 },
{ "FOX LEGENDARIO MASTER", 1900 },
{ "FOX LEGENDARIO ELITE ", 2000 },
{ "OFICIAL FOX ", 2100 },
{ "OFICIAL FOX MASTER", 2200 },
{ "GEFE GUERRILLERO FOX", 2500 }
}
/* =============================================
|= [TERMINA SECCION MODIFICABLE] =|
==============================================*/
/* ====================================
*[VARIABLES]*
=====================================*/
new g_rango[33], g_frags[33]
new SyncHUD, g_maxplayers, g_msgTeamInfo, g_msgSayText, g_playername[33][32];
#define TASK_HUD 2100
#define ID_HUD (taskid - TASK_HUD)
#define XD is_user_connected(id) || !is_user_bot(id) || !is_user_hltv(id)
new VaultRango[128], szRangos[180], szKey[30]
/* ====================================
*[Cvars]*
=====================================*/
new cvar_Hud, cvar_knifex2, cvar_hsx2
/* ====================================
*[INIT]*
=====================================*/
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "Event_DeathMsg", "a")
register_logevent("logevent_round_end", 2, "1=Round_End")
register_clcmd("say", "message_saytext")
register_clcmd("say_team", "message_sayteam")
/* =============================================
|= [EMPIEZA SECCION MODIFICABLE] =|
==============================================*/
cvar_Hud = register_cvar("rangos_hud", "1") // 1 - Mostrar HUD | 0 - No Mostrar
cvar_knifex2 = register_cvar("rangos_knifex2", "1") // 1 - x2 frags con knife | 0 - ÑO :v
cvar_hsx2 = register_cvar("rangos_hsx2", "1") // 1 - x2 frags de HeadShot | 0 - ÑO :v
/* =============================================
|= [TERMINA SECCION MODIFICABLE] =|
==============================================*/
SyncHUD = CreateHudSyncObj()
g_maxplayers = get_maxplayers()
g_msgTeamInfo = get_user_msgid("TeamInfo")
g_msgSayText = get_user_msgid("SayText")
nfv_file("Ranguitos", VaultRango, charsmax(VaultRango))
}
/* ====================================
*[PRECACHE]*
=====================================*/
public plugin_precache()
precache_sound(Sonido)
/* ===================================
*[HUD]*
=====================================*/
public HUD(taskid) {
new id = ID_HUD
if (!is_user_alive(id)) {
id = pev(id, pev_iuser2)
if (!is_user_alive(id)) return;
}
if(id != ID_HUD) {
set_hudmessage(7, 174, 242, 0.60, 0.67, 1, 6.0, 1.0)
ShowSyncHudMsg(ID_HUD, SyncHUD, "Frags: %d || Rango: %s || Adrenalina: %s", g_frags[id], Rangos[g_rango[id]][NOMBRE],jctf_get_adrenaline(id))
} else {
set_hudmessage(7, 174, 242, 0.0, 0.15, 1, 6.0, 1.0)
ShowSyncHudMsg(ID_HUD, SyncHUD, "===|COMUNIDAD FOX|===||>^n||Frags: %d^n||Rango: %s^n======================||>^n||Sig. Rango: %s^n||Frags Restantes: %d^n======================||>^n||%s^n======================||>^n||Adrenalina: %d^n======================||>",
g_frags[id], Rangos[g_rango[id]][NOMBRE], Rangos[g_rango[id]+1][NOMBRE], Rangos[g_rango[id]][FRAGS] - g_frags[id], Web, jctf_get_adrenaline(id))
}
}
/* ==================================
[PUTINSERVER]
===================================*/
public client_putinserver(id) {
get_user_name( id, g_playername[ id ], charsmax( g_playername[ ] ) );
g_rango[id] = 0
g_frags[id] = 0
Cargar(id)
if(get_pcvar_num(cvar_Hud))
set_task(1.0, "HUD", id+TASK_HUD, _, _, "b")
if(!is_user_admin(id)) {
copy(g_AdminTag[id], charsmax(g_AdminTag[]), "")
return
}
Flags = get_user_flags( id );
for(new i; i < sizeof AdminsTags; i++) {
if(Flags & AdminsTags[i][FLAG]) {
copy(g_AdminTag[id], charsmax(g_AdminTag[]), AdminsTags[i][TAG])
break;
}
}
}
/* ==================================
[DISCONNECT]
===================================*/
public client_disconnect(id) {
if(XD) Guardar(id);
remove_task(id+TASK_HUD)
}
/* ==================================
[ROUND END]
===================================*/
public logevent_round_end() {
for(new id = 1; id <= g_maxplayers; id++) {
if(XD)
Guardar(id);
}
}
/* ==================================
[DEATHMSG]
===================================*/
public Event_DeathMsg() {
new attacker = read_data(1)
new victim = read_data(2)
new hs = read_data(3)
new weaponid = get_user_weapon(attacker)
if(victim == attacker) return;
if(is_user_alive(attacker)) {
g_frags[attacker]++
if(get_pcvar_num(cvar_knifex2)) {
if(weaponid == CSW_KNIFE)
g_frags[attacker]++
}
if(get_pcvar_num(cvar_hsx2)) {
if(hs) g_frags[attacker]++
}
AumentarRango(attacker)
}
}
/* ================================
[UPDATE RANGO]
=================================*/
AumentarRango(id) {
new Aumento = false
while(g_frags[id] >= Rangos[g_rango[id]][FRAGS]) {
Aumento = true
g_rango[id]++
}
if(Aumento) {
chatcolor(id, "%s Felicidades subiste al rango: !g[ %s ]", Prefijo, Rangos[g_rango[id]][NOMBRE])
client_cmd(id, "spk %s", Sonido)
Aumento = false
}
}
/*=====================================
*[SAY]*
=====================================*/
public message_saytext(id) {
static said[192]
read_args(said, charsmax(said))
remove_quotes(said)
if (said[0] == '%' || said[0] == '.' || said[0] == '!' || equal (said, ""))
return PLUGIN_HANDLED
if (!ValidMessage(said, 1)) return PLUGIN_CONTINUE;
static color[11], name[32], alive[11]
get_user_team(id,color,charsmax(color))
get_user_name(id,name,charsmax(name))
if (is_user_alive (id)) {
alive = ""
} else {
alive = "*Muerto*"
}
if (is_user_admin(id)) {
if (get_user_flags(id))
format(said, charsmax(said), "^x01%s (^x04 %s^x01 )^x04 [^x03%s^x04]^x01->^x03%s^x01:^x04 %s", alive, Rangos[g_rango[id]][NOMBRE], g_AdminTag[id], name, said)
} else
{
format(said, charsmax(said), "^x01%s (^x04 %s^x01 )^x03 %s^x01: %s", alive, Rangos[g_rango[id]][NOMBRE], name, said)
}
static i, team[11]
for (i = 1; i <= g_maxplayers; i++) {
if (!is_user_connected(i)) continue
get_user_name(id,name,charsmax(name))
if (is_user_admin(i) || is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) {
get_user_team(i, team, charsmax(team))
changeTeamInfo(i, color)
writeMessage(i, said)
changeTeamInfo(i, team)
}
}
return PLUGIN_HANDLED_MAIN;
}
public message_sayteam(id)
{
static said[192]
read_args(said, charsmax(said))
remove_quotes(said)
if ( said[0] == '%' || said[0] == '.' || said[0] == '!' || equal (said, ""))
return PLUGIN_HANDLED
if (!ValidMessage(said, 1)) return PLUGIN_CONTINUE;
static playerTeam, playerTeamName[19]
playerTeam = get_user_team(id)
switch (playerTeam) {
case 1: copy (playerTeamName, 6, "TE")
case 2: copy (playerTeamName, 8, "CT")
default: copy (playerTeamName, 11, "SPEC")
}
static color[11], name[32], alive[11]
get_user_team(id,color,charsmax(color))
get_user_name(id,name,charsmax(name))
if (is_user_alive (id)) {
alive = ""
} else {
alive = "*MUERTO*"
}
if (is_user_admin(id)) {
if (get_user_flags(id))
format(said, charsmax(said), "^x01%s [^x04%s^x01 ] (^x04 %s^x01 )^x04%s^x01->^x03 %s ^x01: %s", alive, playerTeam, Rangos[g_rango[id]], g_AdminTag[id], name, said)
} else {
format(said, charsmax(said), "^x01%s [^x04%s^x01 ] (^x04 %s^x01 )^x03 %s ^x01: %s", alive, playerTeam, Rangos[g_rango[id]],name, said)
}
static i, team[11]
for (i = 1; i <= g_maxplayers; i++) {
if (!is_user_connected(i)) continue;
get_user_name(id,name,charsmax(name))
if (get_user_team(i) == playerTeam || is_user_admin(i)) {
if (is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) {
get_user_team(i, team, charsmax(team))
changeTeamInfo(i, color)
writeMessage(i, said)
changeTeamInfo(i, team)
}
}
}
return PLUGIN_HANDLED_MAIN;
}
public changeTeamInfo(player, team[]) {
message_begin(MSG_ONE, g_msgTeamInfo, _, player)
write_byte(player)
write_string(team)
message_end()
}
public writeMessage(player, message[]) {
message_begin(MSG_ONE, g_msgSayText, {0, 0, 0}, player)
write_byte(player)
write_string(message)
message_end()
}
/* ===================================
*[GUARDADO]*
=====================================*/
Guardar(id) {
formatex(szKey, charsmax(szKey), "data_rangos")
formatex(szRangos, charsmax(szRangos), "%d %d", g_frags[id], g_rango[id])
nfv_set_data(VaultRango, szKey, g_playername[id], szRangos)
}
Cargar(id) {
new g_load_c1[25], g_load_c2[25]
formatex(szKey, charsmax(szKey), "data_rangos")
if(!nfv_get_data(VaultRango, szKey, g_playername[id], szRangos, sizeof(szRangos) - 1)) return;
parse(szRangos, g_load_c1, charsmax(g_load_c1), g_load_c2, charsmax(g_load_c2))
g_frags[id] = str_to_num(g_load_c1)
g_rango[id] = str_to_num(g_load_c2)
}
/* ===================================
*[STOCKS]*
=====================================*/
// stock de chatcolor
stock chatcolor( id, const input[], any:... )
{
static szMsg[ 191 ], msgSayText;
if( !msgSayText )
msgSayText = get_user_msgid( "SayText" );
vformat( szMsg, 190, input, 3 );
replace_all( szMsg, 190, "!g", "^4" );
replace_all( szMsg, 190, "!y", "^1" );
replace_all( szMsg, 190, "!t", "^3" );
message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgSayText, .player = id );
write_byte( id ? id : 33 );
write_string( szMsg );
message_end( );
}
// Stock para Saber Si el mensaje es valido
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;
}