05/09/2018, 09:49 PM
Hola a todos!
Tengo un Problema con una constante y es que me arroja este error: Error: Multi-dimensional arrays must be fully initialized
Lo unico que hice fue poner algunos rangos a este sistema:
Code:
Gracias por la ayuda!
Tengo un Problema con una constante y es que me arroja este error: Error: Multi-dimensional arrays must be fully initialized
Lo unico que hice fue poner algunos rangos a este sistema:
Code:
Código PHP:
/*=========================================================================
* Includes
==========================================================================*/
#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"
new Prefix [] = "!g[!yAMXX]!g";
/*=========================================================================
* Defines
==========================================================================*/
#define MaxNiveles 15
#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
17000, // Maestro
20000, // Legendario
25000 // Maestro Supremo
}
new const Rangos[MaxNiveles +1][]=
{
"Recluta", // "Al comienzo"
"Soldado", // "Nivel Nº 1
"Soldado Primero", // Nivel Nº 2
"Soldado Segundo", // Nivel Nº 3
"Cabo", // Nivel Nº 4
"Cabo Primero", // Nivel Nº 5
"Cabo Segundo", // Nivel Nº 6
"Sargento", // Nivel Nº 7
"Sargento Primero", // Nivel Nº 8
"Capitan", // Nivel Nº 9
"Teniente", // Nivel Nº 10
"Coronel", // Nivel Nº 11
"General", // Nivel Nº 12
"Legendario",
"Maestro Supremo"
}
/*=========================================================================
* 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 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", "0" );
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 /lvl", "MuestraLVL")
register_clcmd ( "say_team /lvl", "MuestraLVL")
register_clcmd ( "say /reset", "Resetear")
register_clcmd ( "say_team /reset", "Resetear")
/*=========================================================================
* Registro de Variables
==========================================================================*/
gMaxPlayers = get_maxplayers( );
gMsgSync3 = CreateHudSyncObj()
}
/*=========================================================================
* Muestra de ' EXP - NIVEL - RESET '
==========================================================================*/
public MuestraXP(id)
{
ChatColor(id, "%s !yTu experiencia es de: !g%i/%i", Prefix, Exp[id], Experiencia[Nivel[id]])
}
public MuestraLVL(id)
{
ChatColor(id, "%s !yTu rango es: !g%s!y!", Prefix, Rangos[Nivel[id]])
}
public MuestraRTS(id)
{
ChatColor(id, "%s !yTu tienes: !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 );
set_task(0.1, "ShowHud", 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, "%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, "%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)
// Hud
set_task( 60.0, "ShowHud", id, .flags = "b" );
//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, "%s!y Tu tienes!g %i!y de XP por matar a!g %s!y con un !g'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, "%s!y Tu tienes!g %i!y de XP por matar !g %s!y con un !g'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, "%s!y Tu tienes!g %i!y de XP por matar a!g %s!y con una !g'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, "%s!y Tu tienes!g %i!y de XP por matar a!g %s con el !g'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, "%s!y Felicidades!y, ha subido de nivel, ahora tu nivel es: !g%s!y", Prefix, Rangos[Nivel[id]])
}
}
}
/*=========================================================================
* Hud-Message
==========================================================================*/
public ShowHud(task)
{
new id = task - HuD-Message
if(!is_user_alive(id))
return;
set_hudmessage(0, 112, 0, 0.02, 0.33, 0, 0.0, 0.3, 0.0, 0.0)
ShowSyncHudMsg(id, gMsgSync3,"[Nivel : %s]^n[EXP : %i/%i]^n^n[Reset/s : %i]", Rangos[Nivel[id]], Exp[id], Experiencia[Nivel[id]], Reset[id])
set_task(0.1, "ShowHud", HuD-Message + id)
}
/*=========================================================================
* Resets nivle
==========================================================================*/
public Resetear(id)
{
if(Nivel[id] == 12)
{
Nivel[id] = 0
Exp[id] = 0
Reset[id] += 1
ChatColor(id, "%s !yFelicidades, ahora tienes !g%i !y' Reset/s '", Prefix, Reset[id]);
}
else
{
ChatColor(id, "%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();
}
}
}
}
Gracias por la ayuda!
Aprendiendo!
Mi Comunidad: http://facebook.com/groups/CsParaisoComunidad/
Me ayudarias muchisimo donandome algo para poder abrir mi comunidad, te lo agradeceria muchisimo!
Click Aqui!
Mi Comunidad: http://facebook.com/groups/CsParaisoComunidad/
Me ayudarias muchisimo donandome algo para poder abrir mi comunidad, te lo agradeceria muchisimo!
Click Aqui!