03/01/2017, 12:07 AM
buenas, mi problema es el sgt este pugin de rangos esta configurado para sv st ya que el rango le toma solo a los que tienen id (St) y a los ns no por lo que se les buguea , esperaria una modificacion ya que yo no ubico mucho el tema, para que estos rangos y sus exp corran por el name de los jugadores y no la id , estare atento ! gracias
Código PHP:
/*=========================================================================
* Incluides
==========================================================================*/
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
/*=========================================================================
* Informacion
==========================================================================*/
new Plugin [] = "Sistema de Niveles ttt"
new Version [] = "1.0"
new Autor [] = "Life"
/*=========================================================================
* Defines
==========================================================================*/
#define MaxNiveles 12
#define Jugador(%1) ( 1 <= %1 <= gMaxPlayers )
#define HuD-Message 10113
/*=========================================================================
* Consts
==========================================================================*/
new const Experiencia[MaxNiveles] =
{
100, // Principiante
200, // Iniciando
400, // Novato
750, // Normal
1200, // Sabiduria
1500, // Soldado
2000, // Cabo
3250, // Sargento
4500, // Capitan
7000, // Mayor
10000, // Coronel
15000 // General
}
new const Rangos[MaxNiveles +1][] =
{
"Aweonao", // "Al comienso"
"aprendiz", // "Nivel Nº 1
"recluta", // Nivel Nº 2
"soldado", // Nivel Nº 3
"cabo", // Nivel Nº 4
"Rambo", // Nivel Nº 5
"jefe", // Nivel Nº 6
"Ingeniero", // Nivel Nº 7
"Sargento", // Nivel Nº 8
"Capitan", // Nivel Nº 9
"Mayor", // Nivel Nº 10
"Coronel", // Nivel Nº 11
"General :O" // Nivel Nº 12
}
/*=========================================================================
* Admines Rangos
==========================================================================*/
enum DatosAdmin
{
Nombre[32],
Kill
}
new const RangosAdmins[][DatosAdmin] =
{
{"Fundador", ADMIN_IMMUNITY},
{"Co - Fundaodr", ADMIN_BAN},
{"Super-Moderador", ADMIN_CFG},
{"Moderador", ADMIN_KICK},
{"VIP", ADMIN_LEVEL_H}
};
/*=========================================================================
* Variables
==========================================================================*/
new Prefix [] = "[ FullsN ]";
new Nivel[33];
new Exp[33];
new Reset[33];
new CuchiXp, ArmaXp, HeadShotXp, HeGrenadeXp;
new gMsgSync3;
new gMaxPlayers;
/*=========================================================================
* Booleans
==========================================================================*/
new bool:is_user_ignored[ 33 ]
/*=========================================================================
* INICIANDO...
==========================================================================*/
public plugin_init()
{
/*=========================================================================
* Registro del plugin
==========================================================================*/
register_plugin(Plugin, Version, Autor)
register_message(get_user_msgid("SayText"),"Message_SayText");
/*=========================================================================
* Registro del INC Ham
==========================================================================*/
RegisterHam ( Ham_Spawn, "player", "Ham_CheckOthers_Bonus", 1);
RegisterHam ( Ham_TakeDamage, "player", "Ham_CheckDamage_Bonus", .Post = false );
RegisterHam ( Ham_Item_PreFrame, "player", "Ham_CheckSpeed_Bonus", 1);
/*=========================================================================
* Registro de los 'Cvars'
==========================================================================*/
register_cvar( "XP_Reward_MSG", "1" );
register_cvar( "HookAdmin", "1" );
CuchiXp = register_cvar("xp_por_cuchi", "7")
ArmaXp = register_cvar("xp_por_arma", "5")
HeadShotXp = register_cvar("xp_por_headshot", "10")
HeGrenadeXp = register_cvar("xp_por_bomba", "13")
/*=========================================================================
* Registro de comandos
==========================================================================*/
register_clcmd ( "say /xp", "MuestraXP")
register_clcmd ( "say_team /xp", "MuestraXP")
register_clcmd ( "say /rango", "MuestraLVL")
register_clcmd ( "say_team /rango", "MuestraLVL")
/*=========================================================================
* Registro de Variables
==========================================================================*/
gMaxPlayers = get_maxplayers( );
gMsgSync3 = CreateHudSyncObj()
}
/*=========================================================================
* Muestra de ' EXP - NIVEL - RESET '
==========================================================================*/
public MuestraXP(id)
{
ChatColor(id, "!g%s !yTu experiencia es de !g%i/%i", Prefix, Exp[id], Experiencia[Nivel[id]])
}
public MuestraLVL(id)
{
ChatColor(id, "!g%s !yTu rango es !g%s!y!", Prefix, Rangos[Nivel[id]])
}
public MuestraRTS(id)
{
ChatColor(id, "!g%s !yTu tienes es !g%i!y Resets!", Prefix, Reset[id])
}
/*=========================================================================
* Public de los Ham
==========================================================================*/
public Ham_CheckDamage_Bonus( pevVictim, pevInflictor, pevAttacker )
{
if( !( 1 <= pevAttacker <= gMaxPlayers) )
{
return HAM_HANDLED;
}
if( !is_user_alive( pevAttacker ) )
{
return HAM_HANDLED;
}
return HAM_IGNORED;
}
public Ham_CheckSpeed_Bonus( id )
{
if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
{
return HAM_IGNORED;
}
return HAM_IGNORED;
}
public Ham_CheckOthers_Bonus(id)
{
if( !is_user_alive( id ) || cs_get_user_team( id ) != CS_TEAM_T )
return HAM_IGNORED;
remove_task( HuD-Message + id );
return HAM_IGNORED;
}
/*=========================================================================
* Usuario Nivel 12 - HUD
==========================================================================*/
public Jugador_Nvl12_Entra(id)
{
new name[32]
get_user_name(id, name, sizeof(name) -1)
ChatColor(0, "!g%s !yJugador respetado : !g%s !yentro con !g%i !yde XP!", Prefix, name, Exp[id])
}
public Jugador_Nvl12_Sale(id)
{
new name[32]
get_user_name(id, name, sizeof(name) -1)
ChatColor(0, "!g%s !yJugador respetado : !g%s !yse fue con !g%i !yde XP!", Prefix, name, Exp[id])
}
/*=========================================================================
* Usuario entrando
==========================================================================*/
public client_putinserver(id)
{
//Datos
CargarDatos(id)
//Nivel 12
if(Nivel[id] == 12)
{
set_task(5.0, "Jugador_Nvl12_Entra", id)
}
}
/*=========================================================================
* Usuario Desconectado
==========================================================================*/
public client_disconnect(id)
{
GuardarDatos(id)
if(Nivel[id] == 12)
{
set_task(1.0, "Jugador_Nvl12_Sale", id)
}
}
/*=========================================================================
* Usuario Muere
==========================================================================*/
public client_death( iAsesino, iVictima, wpnindex, hitplace )
{
new VictimaName[32]
new AsesinoName[32]
get_user_name( iAsesino, AsesinoName, charsmax( AsesinoName ) )
get_user_name( iVictima, VictimaName, charsmax( VictimaName ) )
if( is_user_ignored[ iAsesino ] )
return PLUGIN_HANDLED_MAIN
get_user_name( iAsesino, AsesinoName, charsmax( AsesinoName ) )
get_user_name( iVictima, VictimaName, charsmax( VictimaName ) )
if( iAsesino != iVictima && ( 1 <= iAsesino <= gMaxPlayers ) && ( 1 <= iVictima <= gMaxPlayers ) && !( hitplace == HIT_HEAD ) && !( wpnindex == CSW_HEGRENADE ) )
{
Exp[iAsesino] += get_pcvar_num(ArmaXp)
if( get_cvar_num("XP_Reward_MSG") == 1 )
{
ChatColor ( iAsesino, "!g%s!y Tu tienes!g %i!y de XP por matar a!g %s!y con un !team'Arma'", Prefix, get_pcvar_num(ArmaXp), VictimaName )
}
}
if( hitplace == HIT_HEAD )
{
Exp[iAsesino] += get_pcvar_num(HeadShotXp)
if( get_cvar_num("XP_Reward_MSG") == 1 )
{
ChatColor ( iAsesino, "!g%s!y Tu tienes!g %i!y de XP por matar !g %s!y con un !team'HeadShot'", Prefix, get_pcvar_num (HeadShotXp), VictimaName )
}
}
if( wpnindex == CSW_HEGRENADE && iAsesino != iVictima )
{
Exp[iAsesino] += get_pcvar_num(HeGrenadeXp)
if( get_cvar_num("XP_Reward_MSG") == 1 )
{
ChatColor( iAsesino, "!g%s!y Tu tienes!g %i!y de XP por matar a!g %s!y con una !team'Granada'", Prefix, get_pcvar_num (HeGrenadeXp), VictimaName )
}
}
if( wpnindex == CSW_KNIFE && iAsesino != iVictima )
{
Exp[iAsesino] += get_pcvar_num(CuchiXp)
if( get_cvar_num("XP_Reward_MSG") == 1 )
{
ChatColor( iAsesino, "!g%s!y Tu tienes!g %i!y de XP por matar a!g %s con el !team'Cuchillo'", Prefix, get_pcvar_num (CuchiXp), VictimaName )
}
}
ChekearLVL(iAsesino)
GuardarDatos(iAsesino)
return PLUGIN_CONTINUE
}
/*=========================================================================
* Chekeacion de los niveles - Level Up!
==========================================================================*/
public ChekearLVL(id)
{
if(Nivel[id] < MaxNiveles-1)
{
while(Exp[id] >= Experiencia[Nivel[id]])
{
Nivel[id] += 1
ChatColor(id, "!g%s!y Buena !!!y, ha subido un nivel, ahora tu nivel es : !g%s!y", Prefix, Rangos[Nivel[id]])
}
}
}
/*=========================================================================
* Resets nivle
==========================================================================*/
public Resetear(id)
{
if(Nivel[id] == 12)
{
Nivel[id] = 0
Exp[id] = 0
Reset[id] += 1
ChatColor(id, "!g%s !yFelizidades, ahora tienes !g%i !y' Reset/s '", Prefix, Reset[id]);
}
else
{
ChatColor(id, "!g%s !yTienes que ser nivel !g12 !ypara poder hacer un reset", Prefix);
}
ChekearLVL(id)
GuardarDatos(id)
}
/*=========================================================================
* Guardar y Cargar niveles
==========================================================================*/
public GuardarDatos(id)
{
new AuthID[35]
new gVault = nvault_open( "SISTEMA_XP" )
get_user_authid(id,AuthID,34)
new vaultkey[64], vaultdata[256]
format(vaultkey, 63,"%s-Mod", AuthID)
format(vaultdata, 255,"%i#%i#%i#", Exp[id], Nivel[id], Reset[id])
nvault_set(gVault, vaultkey, vaultdata)
nvault_close(gVault)
}
public CargarDatos(id)
{
new AuthID[35]
new timestamp
new gVault = nvault_open("SISTEMA_XP")
get_user_authid(id,AuthID,34)
new vaultkey[64], vaultdata[256]
format(vaultkey, 63,"%s-Mod", AuthID)
format(vaultdata, 255,"%i#%i#%i#", Exp[id], Nivel[id], Reset[id])
if(nvault_lookup(gVault, vaultkey, vaultdata, charsmax(vaultdata), timestamp))
{
nvault_get(gVault, vaultkey, vaultdata, 255)
replace_all(vaultdata, 255, "#", " ")
new JugadorXp[32], JugadorNivel[32], JugadorReset[32]
parse(vaultdata, JugadorXp, 31, JugadorNivel, 31, JugadorReset, 31)
Exp[id] = str_to_num ( JugadorXp )
Nivel[id] = str_to_num ( JugadorNivel )
Reset[id] = str_to_num ( JugadorReset )
}
}
/*=========================================================================
* Hook_Say Admines - Rangos
==========================================================================*/
public Message_SayText(msgId,msgDest,msgEnt)
{
new id = get_msg_arg_int(1);
if( is_user_connected(id) )
{
if( get_cvar_num("HookAdmin") == 1 )
{
new flags = get_user_flags(id)
for(new i; i<sizeof(RangosAdmins); i++)
{
if( flags & RangosAdmins[i][Kill] )
{
new szCanal[64]
get_msg_arg_string(2, szCanal, charsmax(szCanal))
if( equal(szCanal, "#Cstrike_Chat_All") )
{
formatex(szCanal, charsmax(szCanal), "^4[%s] [%s] ^3%%s1 ^1: %%s2", RangosAdmins[i][Nombre], Rangos[Nivel[id]])
set_msg_arg_string(2, szCanal)
}
else if( !equal(szCanal, "#Cstrike_Name_Change") )
{
format(szCanal, charsmax(szCanal), "^4[%s] [%s] %s", RangosAdmins[i][Nombre], Rangos[Nivel[id]], szCanal)
set_msg_arg_string(2, szCanal)
}
return
}
else
{
new szCanal[64]
get_msg_arg_string(2, szCanal, charsmax(szCanal))
if( equal(szCanal, "#Cstrike_Chat_All") )
{
formatex(szCanal, charsmax(szCanal), "^4[%s] ^3%%s1 ^1: %%s2", Rangos[Nivel[id]])
set_msg_arg_string(2, szCanal)
}
else if( !equal(szCanal, "#Cstrike_Name_Change") )
{
format(szCanal, charsmax(szCanal), "^4[%s] %s", Rangos[Nivel[id]], szCanal)
set_msg_arg_string(2, szCanal)
}
return
}
}
}
else
{
new szCanal[64]
get_msg_arg_string(2, szCanal, charsmax(szCanal));
if( equal(szCanal, "#Cstrike_Chat_All") )
{
formatex(szCanal, charsmax(szCanal), "^4[%s] ^3%%s1 ^1: %%s2", Rangos[Nivel[id]])
set_msg_arg_string(2, szCanal)
}
else if( !equal(szCanal, "#Cstrike_Name_Change") )
{
format(szCanal, charsmax(szCanal), "^4[%s] %s", Rangos[Nivel[id]], szCanal)
set_msg_arg_string(2, szCanal)
}
return
}
}
}
/*=========================================================================
* Stock del ColorChat
==========================================================================*/
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Color Verde
replace_all(msg, 190, "!y", "^1") // Color Amarillo
replace_all(msg, 190, "!team", "^3") // Color de tu Equipo
replace_all(msg, 190, "!team2", "^0") // Color de Espectador
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, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
Junior al cuadrado , paciencia