Ir a contenido

PURCHASE MEMBERSHIP AT A 25% DISCOUNT Apply here

GET 1 MONTH OF MEMBERSHIP BY CHOOSING THE NEW NAME OF OUR COMPANY! Apply here


Photo

DRx Anime


      
DRx Anime TvOTohoDRx Anime TvOToho
DRx Anime

Kaede
#1

Kaede
  • Kaede
  • member
  • Mensajes :
    83
  • Reputación :
    18
  • Points :
    15
  • Registrado :
    2012-08-08
[ide="c_cpp"][You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]

[You must be registered and logged in to see this link.] siguientenivel(%1)    (%1 * 25) // Definimos el macro que nos dice cuantos frags se van a necesitar para el siguiente nivel, en este caso van de 25 en 25
[You must be registered and logged in to see this link.] HUD_ID (taskid-TASK_HUD) // Task del hud
[You must be registered and logged in to see this link.] TASK_HUD 12312
[You must be registered and logged in to see this link.] MAX_NIVEL 100

new Nivel[33], Frags[33] // Definimos las variables Nivel y Frags donde se van a guardar los datos
new HudPrincipal // Variable para el hud

public plugin_init()
{
   
   register_plugin("Niveles por frags", "1.0", "autor")
   
   RegisterHam(Ham_Killer, "player", "fw_PlayerKilled_Post", true)


   HudPrincipal = CreateHudSyncObj() // Le asignamos un valor a la variable del hud
}

public client_putinserver(id) // Cuando un jugador entra al servidor
{
   Nivel[id] = 1 // Le seteamos el nivel 1
   Frags[id] = 0 // Le seteamos los frags a 0
   set_task(1.0, "ShowHud", id+TASK_HUD, _, _, "b") // Seteamos el task para que se muestre el hud
}
public client_disconnect(id)
   remove_task(id+TASK_HUD) // Removemos el hud

public pw_PlayerKilled_Post(victim, attacker, shouldgib) // Seteamos una public, que dira lo que pasa cuando alguien muere
{
  if( victim == atacker ) || !is_user_alive(attacker) || !is_user_alive(victim) || !is_user_connected(attacker) || !is_user_connected(victim))
  { /*Si la victima == attacker (Se suicida) no le suma frags, si el atacante esta desconectado o la victima esta desconectada
  no le suma frags, el atacante o la victima estan muerto no suma frags eso significa ese if()*/
     return HAM_IGNORED; // returnamos para que no sume frags
  }
  Frags[id]++ // si el if() no se cumple, le suma 1 frags al asesinar
 
 
 

public chequear_nivel(id) // chequeamos los niveles
{
   static level; // no se para que sirve
   level = Nivel[id]; // definimos que el leve = al nivel del usuario
   
   if(Nivel[id] == MAX_NIVEL) // declaramos que si su nivel, es igual al nivel maximo returne
   {
      return PLUGIN_HANDLED; // returnamos
   }
   
   if(Frags[id] >= siguientenivel(Nivel[id])) // Si los frags del jugador son mayores o iguales a los requeridos para el siguiente nivel
   {
       Nivel[id]++ // Le aumentamos un nivel
       Frags[id] = 0 // Le seteamos los frags a 0
  client_print(id, print_chat, "Felicidades haz subido al nivel %d", Nivel[id]) /*Al cumplirse este id() le manda
  un mensaje al usuario diciendo que subio de nivel*/
   }
}

public ShowHUD(taskid) //Creamos el hud que saldra al usuario
{
   static id;id = HUD_ID // le setamos la ir al hud
   
   if(!is_user_alive(id)) // Si el usuario esta muerto no mostrara el hud
       return;
       
   set_hudmessage(255, 255, 255, 0.02, 0.15, 0, 6.0, 12.0) // seteamos la posicion del hud
   ShowSyncHudMsg(id, HudPrincipal, "Nivel: %d^nFrags: %d", Nivel[id], Frags[id]) // seteamos el mensaje y listo
}[/ide]

      

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in
You cannot reply to topics in this forum
Staff online
Sponsors
  •  TOTAL POSTS
  •  TOTAL MEMBERS
  •  NEWEST MEMBER