Zplague
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Zplague Entrar

Seu portal de Zombie Plague no Brasil


description[ P. Tutorial ] Nvault Em Fvault Empty[ P. Tutorial ] Nvault Em Fvault

more_horiz
Poderia criar 1 tutorial a como transforma nvault em fvault!!!

 not

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
vc quer transformar o arquivo?

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
Biel-oGrande escreveu:
vc quer transformar o arquivo?

sim

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
o plugin* nao o arquivo q fica na data/diretorio

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
Dexter escreveu:
Biel-oGrande escreveu:
vc quer transformar o arquivo?

sim

Não tem como converter o arquivo.

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
rotam escreveu:
o plugin* nao o arquivo q fica na data/diretorio

isso mesmo eh o plugin mals ae k

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
Meio complicado é mais fácil postar o plugin que eu converto

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
Leozinho escreveu:
Meio complicado é mais fácil postar o plugin que eu converto

Código:

/*================================================================================

   -------------------------------------------
   -*- [ZP] Server Addon: LevelUp System XP 3.2 || New Version-*-
   -------------------------------------------

   ~~~~~~~~~~~~~~~
   - Description -
   ~~~~~~~~~~~~~~~
   Level System

   ~~~~~~~~~~~~~~~
   - Changelog -
   ~~~~~~~~~~~~~~~
   v. 1.0 - Plugin Released. Testing...
   v. 1.1 - Fixed Save Level.
   v. 1.2 - Added New cvars, fixed codes + Added plugin code Player Name
   v. 1.3 - Update version: added new cvars + system bonuses
   v. 1.4 - New modes for nemesis level & survivor level, added cvars
   v. 1.5 - Testing...
   v. 1.6 - Added cvars, Plugin Released.
   v. 1.7 - Added Multilangual, Update plugin
   v. 1.8 - v. 1.9 - Fixed Level Up bugs
   v. 2.0 - Added new cvars + XP Level Extended: Real Level System.
   v. 2.1 - Fixed bugs.
   --
   v. 2.8 - It is globally altered on a new kind of the version of this plugin
   v. 2.9 - Added New cvars. Ful fixed.
   v. 3.0 - XP Mode Updated in EXP to level.
   v. 3.1 - Fixed Bug Shutting Down Server.
   v. 3.2 - Added Give Level & give exp.
================================================================================*/

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "[ZP] Server Addon: LevelUp System XP 3.2"
#define VERSION "3.2"
#define AUTHOR "Re.Act!ve"
#define ACCES ADMIN_CVAR
#pragma tabsize 0
new SayText
new g_level[32], g_level_data, g_frags_level, g_ScreenFade, g_level_del[33], g_level_bonus, g_ammo
new g_level_max, g_give_ammo, g_give_ammopacks, g_level_num, g_level_info, g_player_name, g_levels[32], g_h_damage
new g_h_health, g_h_speed, g_z_damage, h_health[32], h_speed[32], h_damage[32], z_damage[32], level_exp[32]
new g_level_exp[32], g_exp_data, g_Players, g_hud_color, red, green, blue, nameid[32]
new bool:g_bonus[32], g_trime[32]
new sound_level_up[] = { "misc/zp_level_up.wav"}
new sound_health[] = { "items/medshot4.wav" }
// Zombie Classes MUST be registered on plugin_precache

public plugin_precache()
{
        precache_sound( sound_level_up )
        precache_sound( sound_health )
}

public plugin_init()
{
   g_frags_level =       register_cvar("zp_level_frags", "20")      // Сколько добавится экспы для получения след. уровня
   g_level_max  =       register_cvar("zp_level_max", "70")         // Максимальный левел
   g_give_ammo =       register_cvar("zp_level_give_ammo", "1")   // Давать аммо паки при каждом полученном левле?
   g_give_ammopacks = register_cvar("zp_level_ammo", "10")      // Сколько давать аммопаков? (если выше установлено 1)

   g_h_damage =       register_cvar("zp_level_h_damage", "1")      // Увеличивать с каждым уровнем урон на Х у людей
   g_h_health =       register_cvar("zp_level_h_health", "10")      // Люди получают за каждый левел дополнительные Х хп
   g_h_speed =       register_cvar("zp_level_h_speed", "1.0")      // На сколько величивать скорость людей с каждым уровнем?
   g_z_damage =       register_cvar("zp_level_z_damage", "3")      // Увеличивать с каждым уровнем урон на Х у зомби

   g_hud_color =       register_cvar("zp_level_hud_type", "1")      // 1 - Желтый, 2 - Рандомно каждую секунду 3 - 1 раз рандомно
   g_level_info =       register_cvar("zp_level_info", "1")            // Показывать инфу о игроке, когда вы вводите в чат info <nick>
   g_player_name =    register_cvar("zp_player_name", "1")      // Показывать инфу, при наведении курсором на игрока?
   g_level_bonus =       register_cvar("zp_level_bonus_on", "0")      // Можно ли будет снимать мегабонус? (за получение опр. левла)
   g_level_num =       register_cvar("zp_level_number", "5")   // Каждые Х левлов будет возможность снять  мегабонус (если выше 1)
   g_ammo =          register_cvar("zp_level_bonus", "0")      // Сколько аммо паков этот мегабонус?

   g_level_data = nvault_open("Leveling_Save")
   g_exp_data = nvault_open("Exp_Save")
   register_clcmd("say","say_info");
   register_clcmd("say_team","say_info");
   register_clcmd("zp_levelexp","expa_give", ADMIN_CVAR, "use to give Exp")
   register_clcmd("zp_level_is","level_give", ADMIN_CVAR, "use to give Level")
   SayText = get_user_msgid("SayText")
   g_Players = get_maxplayers();
   register_event("HLTV", "Round_Start", "a", "1=0", "2=0")
   register_event("DeathMsg", "Frags_Manager", "a", "1>0")    
   RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
   register_dictionary("zp_level_system_xp.txt")
   register_event("StatusValue","show_status","be","1=2","2!0")
         register_event("StatusValue","hide_status","be","1=1","2=0")
   g_ScreenFade = get_user_msgid( "ScreenFade" )
   register_plugin(PLUGIN, VERSION, AUTHOR)
}

public Round_Start()
{
   for(new id=1;id<=g_Players;id++)
   set_task(3.0, "Level", id)
}

public Level(id)
{
   if( !zp_get_user_zombie(id) && is_user_alive(id) )
   {
      g_trime[id] = false;
      new n = 1;
      while( n < g_level[id] )
      {
         h_health[id] = n * get_pcvar_num(g_h_health);
         h_speed[id] = n * get_pcvar_num(g_h_speed);
         h_damage[id] = n * get_pcvar_num(g_h_damage);
         z_damage[id] = n * get_pcvar_num(g_z_damage);
         n = n + 1
      }
      new Float:speed[32];
      speed[id] = fm_get_user_maxspeed(id) + h_speed[id];
      fm_set_user_health( id, get_user_health(id) + h_health[id] )
      set_pev(id, pev_maxspeed, speed[id] )
      emit_sound(id, CHAN_STREAM, sound_health, 1.0, ATTN_NORM, 0, PITCH_HIGH )
   }
}

public expa_give(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
   {            
      console_print(id, "У вас нет доступа к команде")
      return PLUGIN_HANDLED
   }
   new target[32]
   new count[32]   
   
   read_argv(1,target,31)
   read_argv(2,count,31)
   new target_id, name[32], nameid[32]
   target_id = find_player("bl", target)
   get_user_name(target_id, name, sizeof name - 1)
   get_user_name(id, nameid, sizeof nameid - 1)
   if(!target_id)
   {
      console_print(id, "Can't find that player")
      return PLUGIN_HANDLED
   }
   if(read_argc() != 3)
   return PLUGIN_HANDLED   

   if(str_to_num(count) < (g_level_exp[target_id] - level_exp[target_id]) )
   {
      if(str_to_num(count) == 0)
      console_print(id, "Exp Player %s in %i / %i", name, level_exp[target_id], g_level_exp[target_id])
      else
      {
         console_print(id, "Player %s gives for %i exp, Her Maximum %i", name, str_to_num(count), g_level_exp[target_id])
         level_exp[target_id] = level_exp[target_id] + str_to_num(count);
      }
      
   }
   else
   {
      console_print(id, "Maximum Exp in player %i", g_level_exp[target_id])
   }
   return PLUGIN_HANDLED
}

public level_give(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
   {            
      console_print(id, "У вас нет доступа к команде")
      return PLUGIN_HANDLED
   }
   new target[32]
   new count[32]   
   
   read_argv(1,target,31)
   read_argv(2,count,31)
   new target_id, name[32], level_id
   level_id = str_to_num(count);
   target_id = find_player("bl", target)
   get_user_name(target_id, name, sizeof name - 1)
   if(!target_id)
   {
      console_print(id, "Can't find that player")
      return PLUGIN_HANDLED
   }
   if(read_argc() != 3)
   return PLUGIN_HANDLED   

   if( ((g_level[target_id] + level_id) <=get_pcvar_num(g_level_max)) && (level_id != 0) && ((g_level[target_id] + level_id) > 0 ) )
   {
      if(level_id > 0)
      {
         g_level[target_id] = g_level[target_id] + level_id;
         message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, target_id)
               write_short(1<<12) // duration
              write_short(1) // hold time
         write_short(0x0000) // fade type
         write_byte(1) // red
         write_byte(200) // green
         write_byte(0) // blue
         write_byte(205) // alpha
         message_end()
         emit_sound(target_id, CHAN_STREAM, sound_level_up, 1.0, ATTN_NORM, 0, PITCH_HIGH )
      }
      else
      {
         g_level[target_id] = g_level[target_id] + level_id;
         message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, target_id)
               write_short(1<<12) // duration
              write_short(1) // hold time
         write_short(0x0000) // fade type
         write_byte(200) // red
         write_byte(40) // green
         write_byte(0) // blue
         write_byte(205) // alpha
         message_end()
      }
         console_print(id, "Player %s gives add %i level", name, level_id)
   }
   else
      console_print(id, "Operation Invalid")
   return PLUGIN_HANDLED
}

public client_putinserver(id)
{
   Level_Load(id)
   new name[32]
   g_trime[id] = false;
   g_bonus[id] = true;
   nameid[id] = get_user_name(id, name, sizeof name - 1)
   if( !zp_get_user_zombie(id) && is_user_alive(id))
   {
      g_trime[id] = false;
      new n = 1;
      while( n != g_level[id] )
      {
         h_health[id] = n * get_pcvar_num(g_h_health);
         h_speed[id] = n * get_pcvar_num(g_h_speed);
         h_damage[id] = n * get_pcvar_num(g_h_damage);
         z_damage[id] = n * get_pcvar_num(g_z_damage);
         n = n + 1;
      }
      new Float:speed[32];
      speed[id] = fm_get_user_maxspeed(id) + h_speed[id];
      fm_set_user_health( id, get_user_health(id) + h_health[id] )
      set_pev(id, pev_maxspeed, speed[id] )
      emit_sound(id, CHAN_STREAM, sound_health, 1.0, ATTN_NORM, 0, PITCH_HIGH )
   }

   if( g_level[id] == 0) g_level[id] = 1;
   if( level_exp[id] == g_level[id] ) level_exp[id] = 0;
   if(g_level[id] < get_pcvar_num(g_level_num))
   g_levels[id] = get_pcvar_num(g_level_num);
   else
   {
      if(g_level[id] != g_levels[id])
      {
         new x = 1;
         while( g_level[id] > ( x * get_pcvar_num(g_level_num)) )
         {
            x = x + 1;
            g_levels[id] = x * get_pcvar_num(g_level_num);
         }
      }
   }
   new y = 1;
   while( g_level[id] != y )
   {
   y = y + 1;
   g_level_exp[id] = y * get_pcvar_num(g_frags_level);
   }
   red = random_num(10, 200)
   green = random_num(10, 200)
   blue = random_num(10, 200)
}

public client_disconnect(id)
{
   new name[32], player_nick[32]
   player_nick[id] = get_user_name(id, name, sizeof name - 1)
   if(player_nick[id] == nameid[id])
   Level_Save(id)
   
   g_trime[id] = false;
}

public hide_status(id)
{
       set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4)
       show_hudmessage(id,"")
}

public show_status(id)
{
       new name[32],pid = read_data(2)
       get_user_name(pid,name,31)
     if (!zp_get_user_zombie(pid) && !zp_get_user_zombie(id) && (get_pcvar_num(g_player_name) == 1) )
   {
            set_hudmessage(0,0,255,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
            show_hudmessage(id,"%L", LANG_PLAYER, "PLAYER_NAME_H", name, g_level[pid],                         get_user_health(pid),get_user_armor(pid),zp_get_user_ammo_packs(pid))
   }
    if(zp_get_user_zombie(id) && zp_get_user_zombie(pid) && (get_pcvar_num(g_player_name) == 1) )
   {
        set_hudmessage(255,0,0,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
        show_hudmessage(id,"%L", LANG_PLAYER, "PLAYER_NAME_Z", name, g_level[pid], get_user_health(pid), zp_get_user_ammo_packs(pid))
   }
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
{
   if ( !zp_get_user_zombie(attacker) && is_user_alive(attacker) )
   SetHamParamFloat(4, damage + h_damage[attacker])
   else
   {
      if ( zp_get_user_zombie(attacker) && is_user_alive(attacker) && !zp_get_user_nemesis(attacker))
      SetHamParamFloat(4, damage + z_damage[attacker]);
   }
}

public say_info(id)
{
   new text[70], arg1[32], target[32], count[32]
   read_args(text, sizeof(text)-1);
   remove_quotes(text);
   arg1[0] = '^0';
   target[0] = '^0';
   count[0] = '^0';
   parse(text, arg1, sizeof(arg1)-1, target, sizeof(target)-1, count, sizeof(count)-1);
   if ( equali(arg1, "info", 4) )
   {
      info_player(id, target);
   }
   if ( equali(arg1, "bonusme", 7) && (get_pcvar_num(g_level_info) == 1))
   {
      bonus_player(id);
   }
   if ( equali(arg1, "levelexp", 7) && (get_pcvar_num(g_level_info) == 1))
   {
      expa_player(id);
   }
   return PLUGIN_CONTINUE;
}

public zp_extra_item_selected(id, itemid)
{
   Level_Save(id)
}

public zp_user_infected_pre(id, infector)
{
   if( is_user_alive(infector) && (level_exp[infector] < (g_level_exp[infector] - 1)) && zp_get_user_zombie(infector))
   {
      level_exp[infector] = level_exp[infector] + 1;
      Level_Save(infector);
   }
   else
   if (zp_get_user_zombie(infector))
      ChatColor(infector, "!g[ZP] !y Killed Zombie")
}

public info_player(id, target[])
{
   new target_2;
   target_2 = find_player("bl", target)
   static name[32], nameid[32];
   get_user_name(target_2, name, sizeof name - 1)
   get_user_name(id, nameid, sizeof nameid - 1)
   if(!target_2)
   {
      ChatColor(id, "!g[ZP] !y%L", LANG_PLAYER, "LEVEL_INFO_NONAME")
      return PLUGIN_HANDLED
   }

   if(zp_get_user_zombie(id))
   {
      if(id != target_2)
      {
         ChatColor(id, "!g[INFO]!t %L", LANG_PLAYER, "LEVEL_INFOZM", name, g_level[target_2], z_damage[target_2], zp_get_user_ammo_packs(target_2) )
         ChatColor(target_2, "!g[INFO]!t%L ", LANG_PLAYER, "LEVEL_INFO_YOU", nameid)
      }
      else
      {
         ChatColor(id, "!g[INFOME]!t%L", LANG_PLAYER, "LEVEL_INFOME_ZM", z_damage[target_2] )
      }
   }
   else
   {
      if(id != target_2)
      {
         ChatColor(id, "!g[INFO]!t %L", LANG_PLAYER, "LEVEL_INFO", name, g_level[target_2], h_damage[target_2],                      h_speed[target_2], h_health[target_2], zp_get_user_ammo_packs(target_2) )
         ChatColor(target_2, "!g[INFO]!t%L ", LANG_PLAYER, "LEVEL_INFO_YOU", nameid)
      }
      else
      {
         ChatColor(id, "!g[INFOME]!t%L", LANG_PLAYER, "LEVEL_INFOME", h_damage[target_2], h_speed[target_2],                      h_health[target_2] )
      }
   }
   return PLUGIN_HANDLED
}

public bonus_player(id)
{
   if( (g_level[id] >= g_levels[id]) && g_bonus[id] && get_pcvar_num(g_level_bonus))
   {
      g_levels[id] = g_levels[id] * 2;
      g_level_del[id] = g_level[id];
      g_bonus[id] = false;
      ChatColor(id, "!g[BONUS]%L", LANG_PLAYER, "LEVEL_MEGABONUS", g_level[id], get_pcvar_num(g_ammo) )
      zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + get_pcvar_num(g_ammo) )
      Level_Save(id)
   }
   else
   {
      if(g_level[id] < g_levels[id])
      {
         g_levels[id] = get_pcvar_num(g_level_num);
         ChatColor(id, "!g[BONUS]!y%L", LANG_PLAYER, "LEVEL_NOMEGABONUS", g_levels[id], get_pcvar_num(g_ammo) )
      }
      else
      {
         new x = 1;
         while( g_level[id] > ( x * get_pcvar_num(g_level_num)) )
         {
            g_levels[id] = x * get_pcvar_num(g_level_num);
            x = x + 1;
         }
         ChatColor(id, "!g[BONUS]!y%L", LANG_PLAYER, "LEVEL_NOMEGABONUS", g_levels[id], get_pcvar_num(g_ammo) )
      }

      Level_Save(id)
   }
   return PLUGIN_HANDLED
}

public expa_player(id)
{
   ChatColor(id, "!g[EXPA] %L", LANG_PLAYER, "LEVEL_EXP", level_exp[id], g_level_exp[id])
   return PLUGIN_HANDLED
}

public level_status(id)
{
   if( is_user_alive(id))
   {
      switch( get_pcvar_num(g_hud_color) )
           {
                  case 1:
                  {
         set_hudmessage(255, 200, 3, 0.02, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1)
         show_hudmessage(id,"%L", LANG_PLAYER, "LEVEL_STATUS", g_level[id], level_exp[id])
                  }
                  case 2:
         {
         static r, g, b; r = random_num(10, 200), g = random_num(0, 200), b = random_num(0, 200);
         set_hudmessage(r, g, b, 0.02, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1)
         show_hudmessage(id,"%L", LANG_PLAYER, "LEVEL_STATUS", g_level[id], level_exp[id])
         }
                  case 3:
         {
         
         set_hudmessage(red, green, blue, 0.02, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1)
         show_hudmessage(id,"%L", LANG_PLAYER, "LEVEL_STATUS", g_level[id], level_exp[id])
         }
      }
   }
}

public Level_Save(id)
{
   new key[64], data[256], data_exp[256], key_exp[64]
   new name[33];
   get_user_name(id,name,32)

   format(key, 63, "%s-/", name)
   format(data, 255, "%i#", g_level[id])

   format(key_exp, 63, "%s-/", name)
   format(data_exp, 255, "%i#", level_exp[id])

   nvault_set(g_level_data, key, data)
   nvault_set(g_exp_data, key_exp, data_exp)
   return PLUGIN_CONTINUE;
}

public Level_Load(id)
{
   new key[64], data[256], data_exp[256], key_exp[64]
   new name[33];
   get_user_name(id,name,32)

   format(key, 63, "%s-/", name)
   format(data, 255, "%i#", g_level[id])

   format(key_exp, 63, "%s-/", name)
   format(data_exp, 255, "%i#", level_exp[id])

   nvault_get(g_level_data, key, data, 255)
   nvault_get(g_exp_data, key_exp, data_exp, 255)
   replace_all(data, 255, "#", " ")
   replace_all(data_exp, 255, "#", " ")

   new givelevel[32], give_exp[32]
   parse(data, givelevel, 31)
   parse(data_exp, give_exp, 31)
   g_level[id] = str_to_num(givelevel)
   level_exp[id] = str_to_num(give_exp)

   set_task(1.0, "level_status", id, _, _, "b")
   return PLUGIN_CONTINUE;
}

public Frags_Manager()
{
   new aname[32], attacker; attacker = read_data(1)
   new y; y = 1;
   get_user_name(attacker, aname, sizeof aname - 1)
   if( ( level_exp[attacker] >= (g_level_exp[attacker] - 1) ) && (g_level[attacker] <= get_pcvar_num(g_level_max)) && is_user_alive(attacker) )
   {
      g_bonus[attacker] = true;
      g_level[attacker] = g_level[attacker] + 1;
      level_exp[attacker] = 0;
      while( g_level[attacker] != y )
      {
         y = y + 1;
         g_level_exp[attacker] = y * get_pcvar_num(g_frags_level);
      }
      message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, attacker)
            write_short(1<<12) // duration
           write_short(1) // hold time
      write_short(0x0000) // fade type
      write_byte(1) // red
      write_byte(200) // green
      write_byte(0) // blue
      write_byte(205) // alpha
      message_end()
      emit_sound(attacker, CHAN_STREAM, sound_level_up, 1.0, ATTN_NORM, 0, PITCH_HIGH )
      set_hudmessage(0, 200, 0, 0.65, 0.5, 0, 0.0, 3.0, 2.0, 1.0, -1)
      show_hudmessage(0, "%L", LANG_PLAYER, "LEVEL_UP", aname, g_level[attacker])
      if(get_pcvar_num(g_give_ammo) == 1)
      {
         ChatColor(attacker, "!g[LEVEL] !y %L", LANG_PLAYER, "BONUS_LEVEL", get_pcvar_num(g_give_ammopacks) )
         zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(g_give_ammopacks) )
      }
      Level_Save(attacker);
   }
   else
   {

      if(g_level[attacker] == get_pcvar_num(g_level_max))
      ChatColor(attacker, "!g[LEVEL]!y %L", LANG_PLAYER, "LEVEL_MAX", g_level[attacker] )
      level_exp[attacker] = level_exp[attacker] + 1;
      Level_Save(attacker);
   }
}

public zp_round_ended(winteam)
{
   for(new id=1;id<=g_Players;id++)
   g_trime[id] = true;
}

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") // Green Color
   replace_all(msg, 190, "!y", "^1") // Default Color
   replace_all(msg, 190, "!t", "^3") // Team Color
   replace_all(msg, 190, "!t2", "^0") // Team2 Color

   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, SayText, _, players[i])
            write_byte(players[i]);
            write_string(msg);
            message_end();
         }
      }
   }
}

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
Testa ae 

Código:

/*================================================================================

-------------------------------------------
-*- [ZP] Server Addon: LevelUp System XP 3.2 || New Version-*-
-------------------------------------------

~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~
Level System

~~~~~~~~~~~~~~~
- Changelog -
~~~~~~~~~~~~~~~
v. 1.0 - Plugin Released. Testing...
v. 1.1 - Fixed Save Level.
v. 1.2 - Added New cvars, fixed codes + Added plugin code Player Name
v. 1.3 - Update version: added new cvars + system bonuses
v. 1.4 - New modes for nemesis level & survivor level, added cvars
v. 1.5 - Testing...
v. 1.6 - Added cvars, Plugin Released.
v. 1.7 - Added Multilangual, Update plugin
v. 1.8 - v. 1.9 - Fixed Level Up bugs
v. 2.0 - Added new cvars + XP Level Extended: Real Level System.
v. 2.1 - Fixed bugs.
--
v. 2.8 - It is globally altered on a new kind of the version of this plugin
v. 2.9 - Added New cvars. Ful fixed.
v. 3.0 - XP Mode Updated in EXP to level.
v. 3.1 - Fixed Bug Shutting Down Server.
v. 3.2 - Added Give Level & give exp.
================================================================================*/

#include <amxmodx>
#include <amxmisc>
#include <fvault>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "[ZP] Server Addon: LevelUp System XP 3.2"
#define VERSION "3.2"
#define AUTHOR "Re.Act!ve"
#define ACCES ADMIN_CVAR
#pragma tabsize 0

new const g_exp_data[] = "Exp_Save"
new const g_level_data[] = "Leveling_Save"

new SayText
new g_level[32], g_frags_level, g_ScreenFade, g_level_del[33], g_level_bonus, g_ammo
new g_level_max, g_give_ammo, g_give_ammopacks, g_level_num, g_level_info, g_player_name, g_levels[32], g_h_damage
new g_h_health, g_h_speed, g_z_damage, h_health[32], h_speed[32], h_damage[32], z_damage[32], level_exp[32]
new g_level_exp[32], g_Players, g_hud_color, red, green, blue, nameid[32]
new bool:g_bonus[32], g_trime[32]
new sound_level_up[] = { "misc/zp_level_up.wav"}
new sound_health[] = { "items/medshot4.wav" }
// Zombie Classes MUST be registered on plugin_precache

public plugin_precache()
{
   precache_sound( sound_level_up )
   precache_sound( sound_health )
}

public plugin_init()
{
   g_frags_level =      register_cvar("zp_level_frags", "20")      // ??????? ????????? ????? ??? ????????? ????. ??????
   g_level_max  =      register_cvar("zp_level_max", "70")        // ???????????? ?????
   g_give_ammo =      register_cvar("zp_level_give_ammo", "1")  // ?????? ???? ???? ??? ?????? ?????????? ??????
   g_give_ammopacks = register_cvar("zp_level_ammo", "10")      // ??????? ?????? ?????????? (???? ???? ??????????? 1)
   
   g_h_damage =      register_cvar("zp_level_h_damage", "1")      // ??????????? ? ?????? ??????? ???? ?? ? ? ?????
   g_h_health =      register_cvar("zp_level_h_health", "10")      // ???? ???????? ?? ?????? ????? ?????????????? ? ??
   g_h_speed =      register_cvar("zp_level_h_speed", "1.0")      // ?? ??????? ?????????? ???????? ????? ? ?????? ????????
   g_z_damage =      register_cvar("zp_level_z_damage", "3")      // ??????????? ? ?????? ??????? ???? ?? ? ? ?????
   
   g_hud_color =      register_cvar("zp_level_hud_type", "1")      // 1 - ??????, 2 - ???????? ?????? ??????? 3 - 1 ??? ????????
   g_level_info =      register_cvar("zp_level_info", "1")            // ?????????? ???? ? ??????, ????? ?? ??????? ? ??? info <nick>
   g_player_name =    register_cvar("zp_player_name", "1")      // ?????????? ????, ??? ????????? ???????? ?? ???????
   g_level_bonus =      register_cvar("zp_level_bonus_on", "0")      // ????? ?? ????? ??????? ?????????? (?? ????????? ???. ?????)
   g_level_num =      register_cvar("zp_level_number", "5")  // ?????? ? ?????? ????? ??????????? ?????  ????????? (???? ???? 1)
   g_ammo =          register_cvar("zp_level_bonus", "0")      // ??????? ???? ????? ???? ??????????
   
   register_clcmd("say","say_info");
   register_clcmd("say_team","say_info");
   register_clcmd("zp_levelexp","expa_give", ADMIN_CVAR, "use to give Exp")
   register_clcmd("zp_level_is","level_give", ADMIN_CVAR, "use to give Level")
   SayText = get_user_msgid("SayText")
   g_Players = get_maxplayers();
   register_event("HLTV", "Round_Start", "a", "1=0", "2=0")
   register_event("DeathMsg", "Frags_Manager", "a", "1>0")   
   RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
   register_dictionary("zp_level_system_xp.txt")
   register_event("StatusValue","show_status","be","1=2","2!0")
   register_event("StatusValue","hide_status","be","1=1","2=0")
   g_ScreenFade = get_user_msgid( "ScreenFade" )
   register_plugin(PLUGIN, VERSION, AUTHOR)
}

public Round_Start()
{
   for(new id=1;id<=g_Players;id++)
      set_task(3.0, "Level", id)
}

public Level(id)
{
   if( !zp_get_user_zombie(id) && is_user_alive(id) )
   {
      g_trime[id] = false;
      new n = 1;
      while( n < g_level[id] )
      {
         h_health[id] = n * get_pcvar_num(g_h_health);
         h_speed[id] = n * get_pcvar_num(g_h_speed);
         h_damage[id] = n * get_pcvar_num(g_h_damage);
         z_damage[id] = n * get_pcvar_num(g_z_damage);
         n = n + 1
      }
      new Float:speed[32];
      speed[id] = fm_get_user_maxspeed(id) + h_speed[id];
      fm_set_user_health( id, get_user_health(id) + h_health[id] )
      set_pev(id, pev_maxspeed, speed[id] )
      emit_sound(id, CHAN_STREAM, sound_health, 1.0, ATTN_NORM, 0, PITCH_HIGH )
   }
}

public expa_give(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
   {           
      console_print(id, "? ??? ??? ??????? ? ???????")
      return PLUGIN_HANDLED
   }
   new target[32]
   new count[32] 
   
   read_argv(1,target,31)
   read_argv(2,count,31)
   new target_id, name[32], nameid[32]
   target_id = find_player("bl", target)
   get_user_name(target_id, name, sizeof name - 1)
   get_user_name(id, nameid, sizeof nameid - 1)
   if(!target_id)
   {
      console_print(id, "Can't find that player")
      return PLUGIN_HANDLED
   }
   if(read_argc() != 3)
      return PLUGIN_HANDLED 
   
   if(str_to_num(count) < (g_level_exp[target_id] - level_exp[target_id]) )
   {
      if(str_to_num(count) == 0)
         console_print(id, "Exp Player %s in %i / %i", name, level_exp[target_id], g_level_exp[target_id])
      else
      {
         console_print(id, "Player %s gives for %i exp, Her Maximum %i", name, str_to_num(count), g_level_exp[target_id])
         level_exp[target_id] = level_exp[target_id] + str_to_num(count);
      }
      
   }
   else
   {
      console_print(id, "Maximum Exp in player %i", g_level_exp[target_id])
   }
   return PLUGIN_HANDLED
}

public level_give(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
   {           
      console_print(id, "? ??? ??? ??????? ? ???????")
      return PLUGIN_HANDLED
   }
   new target[32]
   new count[32] 
   
   read_argv(1,target,31)
   read_argv(2,count,31)
   new target_id, name[32], level_id
   level_id = str_to_num(count);
   target_id = find_player("bl", target)
   get_user_name(target_id, name, sizeof name - 1)
   if(!target_id)
   {
      console_print(id, "Can't find that player")
      return PLUGIN_HANDLED
   }
   if(read_argc() != 3)
      return PLUGIN_HANDLED 
   
   if( ((g_level[target_id] + level_id) <=get_pcvar_num(g_level_max)) && (level_id != 0) && ((g_level[target_id] + level_id) > 0 ) )
   {
      if(level_id > 0)
      {
         g_level[target_id] = g_level[target_id] + level_id;
         message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, target_id)
         write_short(1<<12) // duration
         write_short(1) // hold time
         write_short(0x0000) // fade type
         write_byte(1) // red
         write_byte(200) // green
         write_byte(0) // blue
         write_byte(205) // alpha
         message_end()
         emit_sound(target_id, CHAN_STREAM, sound_level_up, 1.0, ATTN_NORM, 0, PITCH_HIGH )
      }
      else
      {
         g_level[target_id] = g_level[target_id] + level_id;
         message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, target_id)
         write_short(1<<12) // duration
         write_short(1) // hold time
         write_short(0x0000) // fade type
         write_byte(200) // red
         write_byte(40) // green
         write_byte(0) // blue
         write_byte(205) // alpha
         message_end()
      }
      console_print(id, "Player %s gives add %i level", name, level_id)
   }
   else
      console_print(id, "Operation Invalid")
   return PLUGIN_HANDLED
}

public client_putinserver(id)
{
   Level_Load(id)
   new name[32]
   g_trime[id] = false;
   g_bonus[id] = true;
   nameid[id] = get_user_name(id, name, sizeof name - 1)
   if( !zp_get_user_zombie(id) && is_user_alive(id))
   {
      g_trime[id] = false;
      new n = 1;
      while( n != g_level[id] )
      {
         h_health[id] = n * get_pcvar_num(g_h_health);
         h_speed[id] = n * get_pcvar_num(g_h_speed);
         h_damage[id] = n * get_pcvar_num(g_h_damage);
         z_damage[id] = n * get_pcvar_num(g_z_damage);
         n = n + 1;
      }
      new Float:speed[32];
      speed[id] = fm_get_user_maxspeed(id) + h_speed[id];
      fm_set_user_health( id, get_user_health(id) + h_health[id] )
      set_pev(id, pev_maxspeed, speed[id] )
      emit_sound(id, CHAN_STREAM, sound_health, 1.0, ATTN_NORM, 0, PITCH_HIGH )
   }
   
   if( g_level[id] == 0) g_level[id] = 1;
   if( level_exp[id] == g_level[id] ) level_exp[id] = 0;
   if(g_level[id] < get_pcvar_num(g_level_num))
      g_levels[id] = get_pcvar_num(g_level_num);
   else
   {
      if(g_level[id] != g_levels[id])
      {
         new x = 1;
         while( g_level[id] > ( x * get_pcvar_num(g_level_num)) )
         {
            x = x + 1;
            g_levels[id] = x * get_pcvar_num(g_level_num);
         }
      }
   }
   new y = 1;
   while( g_level[id] != y )
   {
      y = y + 1;
      g_level_exp[id] = y * get_pcvar_num(g_frags_level);
   }
   red = random_num(10, 200)
   green = random_num(10, 200)
   blue = random_num(10, 200)
}

public client_disconnect(id)
{
   new name[32], player_nick[32]
   player_nick[id] = get_user_name(id, name, sizeof name - 1)
   if(player_nick[id] == nameid[id])
      Level_Save(id)
   
   g_trime[id] = false;
}

public hide_status(id)
{
   set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4)
   show_hudmessage(id,"")
}

public show_status(id)
{
   new name[32],pid = read_data(2)
   get_user_name(pid,name,31)
   if (!zp_get_user_zombie(pid) && !zp_get_user_zombie(id) && (get_pcvar_num(g_player_name) == 1) )
   {
      set_hudmessage(0,0,255,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
      show_hudmessage(id,"%L", LANG_PLAYER, "PLAYER_NAME_H", name, g_level[pid],                        get_user_health(pid),get_user_armor(pid),zp_get_user_ammo_packs(pid))
   }
   if(zp_get_user_zombie(id) && zp_get_user_zombie(pid) && (get_pcvar_num(g_player_name) == 1) )
   {
      set_hudmessage(255,0,0,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
      show_hudmessage(id,"%L", LANG_PLAYER, "PLAYER_NAME_Z", name, g_level[pid], get_user_health(pid), zp_get_user_ammo_packs(pid))
   }
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
{
   if ( !zp_get_user_zombie(attacker) && is_user_alive(attacker) )
      SetHamParamFloat(4, damage + h_damage[attacker])
   else
   {
      if ( zp_get_user_zombie(attacker) && is_user_alive(attacker) && !zp_get_user_nemesis(attacker))
         SetHamParamFloat(4, damage + z_damage[attacker]);
   }
}

public say_info(id)
{
   new text[70], arg1[32], target[32], count[32]
   read_args(text, sizeof(text)-1);
   remove_quotes(text);
   arg1[0] = '^0';
   target[0] = '^0';
   count[0] = '^0';
   parse(text, arg1, sizeof(arg1)-1, target, sizeof(target)-1, count, sizeof(count)-1);
   if ( equali(arg1, "info", 4) )
   {
      info_player(id, target);
   }
   if ( equali(arg1, "bonusme", 7) && (get_pcvar_num(g_level_info) == 1))
   {
      bonus_player(id);
   }
   if ( equali(arg1, "levelexp", 7) && (get_pcvar_num(g_level_info) == 1))
   {
      expa_player(id);
   }
   return PLUGIN_CONTINUE;
}

public zp_extra_item_selected(id, itemid)
{
   Level_Save(id)
}

public zp_user_infected_pre(id, infector)
{
   if( is_user_alive(infector) && (level_exp[infector] < (g_level_exp[infector] - 1)) && zp_get_user_zombie(infector))
   {
      level_exp[infector] = level_exp[infector] + 1;
      Level_Save(infector);
   }
   else
      if (zp_get_user_zombie(infector))
      ChatColor(infector, "!g[ZP] !y Killed Zombie")
}

public info_player(id, target[])
{
   new target_2;
   target_2 = find_player("bl", target)
   static name[32], nameid[32];
   get_user_name(target_2, name, sizeof name - 1)
   get_user_name(id, nameid, sizeof nameid - 1)
   if(!target_2)
   {
      ChatColor(id, "!g[ZP] !y%L", LANG_PLAYER, "LEVEL_INFO_NONAME")
      return PLUGIN_HANDLED
   }
   
   if(zp_get_user_zombie(id))
   {
      if(id != target_2)
      {
         ChatColor(id, "!g[INFO]!t %L", LANG_PLAYER, "LEVEL_INFOZM", name, g_level[target_2], z_damage[target_2], zp_get_user_ammo_packs(target_2) )
         ChatColor(target_2, "!g[INFO]!t%L ", LANG_PLAYER, "LEVEL_INFO_YOU", nameid)
      }
      else
      {
         ChatColor(id, "!g[INFOME]!t%L", LANG_PLAYER, "LEVEL_INFOME_ZM", z_damage[target_2] )
      }
   }
   else
   {
      if(id != target_2)
      {
         ChatColor(id, "!g[INFO]!t %L", LANG_PLAYER, "LEVEL_INFO", name, g_level[target_2], h_damage[target_2],                      h_speed[target_2], h_health[target_2], zp_get_user_ammo_packs(target_2) )
         ChatColor(target_2, "!g[INFO]!t%L ", LANG_PLAYER, "LEVEL_INFO_YOU", nameid)
      }
      else
      {
         ChatColor(id, "!g[INFOME]!t%L", LANG_PLAYER, "LEVEL_INFOME", h_damage[target_2], h_speed[target_2],                      h_health[target_2] )
      }
   }
   return PLUGIN_HANDLED
}

public bonus_player(id)
{
   if( (g_level[id] >= g_levels[id]) && g_bonus[id] && get_pcvar_num(g_level_bonus))
   {
      g_levels[id] = g_levels[id] * 2;
      g_level_del[id] = g_level[id];
      g_bonus[id] = false;
      ChatColor(id, "!g[BONUS]%L", LANG_PLAYER, "LEVEL_MEGABONUS", g_level[id], get_pcvar_num(g_ammo) )
      zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + get_pcvar_num(g_ammo) )
      Level_Save(id)
   }
   else
   {
      if(g_level[id] < g_levels[id])
      {
         g_levels[id] = get_pcvar_num(g_level_num);
         ChatColor(id, "!g[BONUS]!y%L", LANG_PLAYER, "LEVEL_NOMEGABONUS", g_levels[id], get_pcvar_num(g_ammo) )
      }
      else
      {
         new x = 1;
         while( g_level[id] > ( x * get_pcvar_num(g_level_num)) )
         {
            g_levels[id] = x * get_pcvar_num(g_level_num);
            x = x + 1;
         }
         ChatColor(id, "!g[BONUS]!y%L", LANG_PLAYER, "LEVEL_NOMEGABONUS", g_levels[id], get_pcvar_num(g_ammo) )
      }
      
      Level_Save(id)
   }
   return PLUGIN_HANDLED
}

public expa_player(id)
{
   ChatColor(id, "!g[EXPA] %L", LANG_PLAYER, "LEVEL_EXP", level_exp[id], g_level_exp[id])
   return PLUGIN_HANDLED
}

public level_status(id)
{
   if( is_user_alive(id))
   {
      switch( get_pcvar_num(g_hud_color) )
      {
         case 1:
         {
            set_hudmessage(255, 200, 3, 0.02, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1)
            show_hudmessage(id,"%L", LANG_PLAYER, "LEVEL_STATUS", g_level[id], level_exp[id])
         }
         case 2:
         {
            static r, g, b; r = random_num(10, 200), g = random_num(0, 200), b = random_num(0, 200);
            set_hudmessage(r, g, b, 0.02, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1)
            show_hudmessage(id,"%L", LANG_PLAYER, "LEVEL_STATUS", g_level[id], level_exp[id])
         }
         case 3:
         {
            
            set_hudmessage(red, green, blue, 0.02, 0.87, 0, 1.0, 1.1, 0.0, 0.0, -1)
            show_hudmessage(id,"%L", LANG_PLAYER, "LEVEL_STATUS", g_level[id], level_exp[id])
         }
      }
   }
}

public Level_Save(id)
{
   new key[64], data[256], data_exp[256], key_exp[64]
   new name[33];
   get_user_name(id,name,32)
   
   format(key, 63, "%s", name)
   format(data, 255, "%i", g_level[id])
   
   format(key_exp, 63, "%s", name)
   format(data_exp, 255, "%i", level_exp[id])
   
   fvault_set_data(g_level_data, key, data)
   fvault_set_data(g_exp_data, key_exp, data_exp)
   return PLUGIN_CONTINUE;
}

public Level_Load(id)
{
   new key[64], data[256], data_exp[256], key_exp[64]
   new name[33];
   get_user_name(id,name,32)
   
   format(key, 63, "%s", name)
   format(data, 255, "%i", g_level[id])
   
   format(key_exp, 63, "%s", name)
   format(data_exp, 255, "%i", level_exp[id])
   
   fvault_get_data(g_level_data, key, data, 255)
   fvault_get_data(g_exp_data, key_exp, data_exp, 255)
   replace_all(data, 255, "#", " ")
   replace_all(data_exp, 255, "#", " ")
   
   new givelevel[32], give_exp[32]
   parse(data, givelevel, 31)
   parse(data_exp, give_exp, 31)
   g_level[id] = str_to_num(givelevel)
   level_exp[id] = str_to_num(give_exp)
   
   set_task(1.0, "level_status", id, _, _, "b")
   return PLUGIN_CONTINUE;
}

public Frags_Manager()
{
   new aname[32], attacker; attacker = read_data(1)
   new y; y = 1;
   get_user_name(attacker, aname, sizeof aname - 1)
   if( ( level_exp[attacker] >= (g_level_exp[attacker] - 1) ) && (g_level[attacker] <= get_pcvar_num(g_level_max)) && is_user_alive(attacker) )
   {
      g_bonus[attacker] = true;
      g_level[attacker] = g_level[attacker] + 1;
      level_exp[attacker] = 0;
      while( g_level[attacker] != y )
      {
         y = y + 1;
         g_level_exp[attacker] = y * get_pcvar_num(g_frags_level);
      }
      message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, attacker)
      write_short(1<<12) // duration
      write_short(1) // hold time
      write_short(0x0000) // fade type
      write_byte(1) // red
      write_byte(200) // green
      write_byte(0) // blue
      write_byte(205) // alpha
      message_end()
      emit_sound(attacker, CHAN_STREAM, sound_level_up, 1.0, ATTN_NORM, 0, PITCH_HIGH )
      set_hudmessage(0, 200, 0, 0.65, 0.5, 0, 0.0, 3.0, 2.0, 1.0, -1)
      show_hudmessage(0, "%L", LANG_PLAYER, "LEVEL_UP", aname, g_level[attacker])
      if(get_pcvar_num(g_give_ammo) == 1)
      {
         ChatColor(attacker, "!g[LEVEL] !y %L", LANG_PLAYER, "BONUS_LEVEL", get_pcvar_num(g_give_ammopacks) )
         zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(g_give_ammopacks) )
      }
      Level_Save(attacker);
   }
   else
   {
      
      if(g_level[attacker] == get_pcvar_num(g_level_max))
         ChatColor(attacker, "!g[LEVEL]!y %L", LANG_PLAYER, "LEVEL_MAX", g_level[attacker] )
      level_exp[attacker] = level_exp[attacker] + 1;
      Level_Save(attacker);
   }
}

public zp_round_ended(winteam)
{
   for(new id=1;id<=g_Players;id++)
      g_trime[id] = true;
}

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") // Green Color
   replace_all(msg, 190, "!y", "^1") // Default Color
   replace_all(msg, 190, "!t", "^3") // Team Color
   replace_all(msg, 190, "!t2", "^0") // Team2 Color
   
   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, SayText, _, players[i])
         write_byte(players[i]);
         write_string(msg);
         message_end();
      }
   }
}
}

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
valeu ^^

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
Facinho de converter de nvault pra fvault eu tinha feito aqui na hora que peguei a sma e depois que terminei o leozinho postou a sma em fvault primeiro kk

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
Closed.

description[ P. Tutorial ] Nvault Em Fvault EmptyRe: [ P. Tutorial ] Nvault Em Fvault

more_horiz
privacy_tip Permissões neste sub-fórum
Não podes responder a tópicos
power_settings_newInicie sessão para responder