BANNED
Join Date: Dec 2011
Location: de_inferno en Julieta
|
09-16-2012
, 21:26
[Solucionado] Resetear Frags, Cada Vez que Aumente 1 Nivel
|
#1
|
Hola,
Bueno tal como dice el Titulo, cuando 1 Usuario o Player Aumenta de Nivel, todo bien le muestra
el Mensaje y que nivel es y todo, pero me di cuenta en el HUD que le agregue, que cuando aumentan
el Nivel, no se Resetea los Frags y es mucho mas Facil subir...
Explico Bien:
Frags para el Siguiente Nivel: 0/3
1 Player mata a otro, le da 1 Frag, mata a otro le da Otro frag y por Ultima vez mata a otro le da el Tercer Frag, el Usuario consigue los 3 Frags necesarios para el Siguiente Nivel y sube de Lvl
El problema es que luego en el Hud dice
Frags para el Siguiente Nivel: 3/8
y solo debe conseguir 5 Frags + para el Siguiente nivel, quisiera que cada vez que aumente de nivel este asi
Frags para el Siguiente Nivel: 0/3
Frags para el Siguiente Nivel: 0/8
Frags para el Siguiente Nivel: 0/15
Frags para el Siguiente Nivel: 0/19
Frags para el Siguiente Nivel: 0/24
Algo asi, aqui les dejo el CODE de todas formas, es facil hacer los Niveles y da lo mismo quien lo copie, porque hay mejores Formas (Por MACRO)
PHP Code:
/* Esto es un ejemplo
-- Por supuesto, esta pensado para los que ya tienen niveles creados
-- Reemplazar variable_de_nivel por su variable de nivel que hallan creado ustds
-- Con eso, y adaptarlo a lo que ustedes quieran, tendria que andar
/\ FORMA 1 /\
*/
// Includes
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <HamSandWich>
// Creditos y pelotudeces
#define PLUGIN "Tuto Rangos"
#define VERSION "1.0"
#define AUTHOR "Manu"
#define ADMIN_LEVEL ADMIN_KICK // Flags
// Ni ganas de explicar :P Jaja
// Creamos la variable que contiene los nombres de los rangos...
new g_level[33] // Levels
new g_frags[33] // Frags para los Niveles
// La cantidad de Frags necesarios para avanzar de un rango a otro
new gRangoNecesario[] = {
0,
3,
6,
10,
16,
20,
25,
36,
40,
48,
56,
68,
79,
90,
97,
98,
104,
115,
122,
136,
148,
156,
162,
170,
178,
184,
202,
214,
226,
239,
254,
280,
300,
332,
356,
393,
420,
446,
479,
500,
545,
598,
624,
658,
700,
756,
801,
854,
914,
1000
}
new szRango[][] = {
"Nivel 0",
"Nivel 1",
"Nivel 2",
"Nivel 3",
"Nivel 4",
"Nivel 5",
"Nivel 6",
"Nivel 7",
"Nivel 8",
"Nivel 9",
"Nivel 10",
"Nivel 11",
"Nivel 12",
"Nivel 13",
"Nivel 14",
"Nivel 15",
"Nivel 16",
"Nivel 17",
"Nivel 18",
"Nivel 19",
"Nivel 20",
"Nivel 21",
"Nivel 22",
"Nivel 23",
"Nivel 24",
"Nivel 25",
"Nivel 26",
"Nivel 27",
"Nivel 28",
"Nivel 29",
"Nivel 30",
"Nivel 31",
"Nivel 32",
"Nivel 33",
"Nivel 34",
"Nivel 35",
"Nivel 36",
"Nivel 37",
"Nivel 38",
"Nivel 39",
"Nivel 40",
"Nivel 41",
"Nivel 42",
"Nivel 43",
"Nivel 44",
"Nivel 45",
"Nivel 46",
"Nivel 47",
"Nivel 48",
"Nivel 49",
"Nivel 50"
}
// Iniciamos el plugin
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /nivel","show_rango")
set_task(2.0,"nombre_hud",0,_,_,"b")
register_cvar("hud_on","1")
}
public client_putinserver(id)
{
reset_vars(id, 1)
set_task(1.0, "nombre_hud", id, _, _, "b")
}
public client_death(attacker, victim, id)
{
if ((cs_get_user_team(attacker) == CS_TEAM_CT) && (cs_get_user_team(victim) == CS_TEAM_T)) // Si el Terro es Atacante ganara 10 frags
{
g_frags[attacker] += 1
print_color(attacker, "!g[AMXX] !nHas Ganado !g1 Frag !npor Matar a un !g==[Terrorista]==")
check_level(attacker)
}
else
{
g_frags[attacker] += 1
print_color(attacker, "!g[AMXX] !nHas Ganado !g1 Frag !npor Matar a un !g==[Anti-Terrorista]==")
check_level(attacker)
}
if (!(get_user_flags(id) & ADMIN_LEVEL))
{
if ((cs_get_user_team(attacker) == CS_TEAM_CT) && (cs_get_user_team(victim) == CS_TEAM_T)) // Si el Terro es Atacante ganara 10 frags
{
g_frags[attacker] += 1
print_color(attacker, "!g[AMXX] !nHas Ganado !g1 Frag MAS !n Porque eres !gADMIN O MODERADOR")
check_level(attacker)
}
else
{
g_frags[attacker] += 1
print_color(attacker, "!g[AMXX] !nHas Ganado !g1 Frag MAS !n Porque eres !gADMIN O MODERADOR")
check_level(attacker)
}
}
}
// Reset Player Vars
reset_vars(id, resetall)
{
if (resetall)
{
g_frags[id] = 0
g_level[id] = 1
}
}
public check_level(id)
{
if (g_frags[id] > gRangoNecesario[sizeof gRangoNecesario - 1] - 1)
return PLUGIN_HANDLED;
while (g_frags[id] >= gRangoNecesario[g_level[id]])
{
g_level[id]++ // Esto es para chequee cuando subes de nivel
print_color(id, "!g [AMXX]!n Felicidades has Subido de Nivel, Ahora eres:!g Nivel %d", g_level[id]) // Cuando subas de nivel te enviara este mensaje diciendote a que nivel subiste
}
return PLUGIN_HANDLED;
}
public nombre_hud() {
if(!get_cvar_num("hud_on")) {
return PLUGIN_HANDLED
}
new players[32],num,i
get_players(players,num)
for(i = 0; i <= num; i++)
{
new id = players[i]
if(is_user_connected(id)) {
new name[33]
get_user_name(id,name,32)
if ( cs_get_user_team ( id ) == CS_TEAM_CT && is_user_alive ( id ) )
{
set_hudmessage (0, 0, 255, 0.01, 0.19, 0, 6.0, 2.0, 0.1, 0.2, 4 )
show_hudmessage(id, "Nombre Jugador CT: %s ^nNivel: %i ^nFrags Siguiente Nivel: %i/%i ^n^n Hud Alliedmods", name, g_level[id], g_frags[id], gRangoNecesario[g_level[id]])
}
else
if ( cs_get_user_team ( id ) == CS_TEAM_T && is_user_alive ( id ) )
{
set_hudmessage (255, 0, 0, 0.01, 0.19, 0, 6.0, 2.0, 0.1, 0.2, 4 )
show_hudmessage(id, "Nombre Jugador TT: %s ^nNivel: %i ^nFrags Siguiente Nivel: %i/%i ^n^n Hud Alliedmods", name, g_level[id], g_frags[id], gRangoNecesario[g_level[id]])
}
}
}
return PLUGIN_CONTINUE
}
public show_rango(index)
{
// Le printeamos el rango actual
print_color(index,"!g [AMXX]!n El Nivel que Tienes Tu es el:!g %s",szRango[g_level[index]])
// Es decir, szRango[el rango actual del user]
// Pongamosle que mi rango es 4, me saltaria el string: General
return PLUGIN_HANDLED
}
stock print_color(const id,const input[], any:...)
{
new msg[191], players[32], count = 1;
vformat(msg,190,input,3);
replace_all(msg,190,"!g","^4");// green
replace_all(msg,190,"!n","^1");// normal
replace_all(msg,190,"!t","^3");// team
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 si me pudiesen Ayudar, creo que deje Claro lo que tengo que hacer si aun no lo entienden, pueden postearlo y les dare una Mejor IDEA
Muchos para el Que me pueda ayudar con este Problema
Last edited by StorM20; 09-16-2012 at 21:41.
|
|