AMX MOD X
Среда, 04.12.2024, 15:49:23



Приветствую Вас Гость | RSS
[ Главная ] [ Плагин free_invis. - AMX Mod X Форум ] [ Регистрация ] [ Вход ]
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]

Вниманию участников! Данный форум теперь является архивом и вскором времени здесь нельзя будет создавать новых тем! Просьба всем для общения и создания новых тем перейти на наш новый форум: http://amxmodx.su/

  • Страница 1 из 1
  • 1
Модератор форума: slogic, AlMod  
Плагин free_invis.
iNFOДата: Суббота, 22.10.2011, 18:32:30 | Сообщение # 1
Рядовой
Группа: Пользователи
Сообщений: 1
Репутация: 0
Статус: Не в сети
Доброе время суток! Подскажите пожалуйста, почему в этом плагине команде КТ не даётся GLOCK при выборе режима invis ?

Code
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <dhudmessage>

new free, invis, fi_touch, rounds = 1, last_round_free, last_round_invis , button_used[33], msgSayText, cvar_time, cvar_rounds_free, cvar_rounds_invis, cvar_free, cvar_free_health, cvar_invis, cvar_invis_health, cvar_hudmsgs, cvar_button

/*Thanks to PomanoB for the help with weaponbox and armoury_entity*/

public plugin_init()
{
  register_plugin("[DR] Free | Invis", "3.1", "WPMG|TEAM")
  register_clcmd("free", "cmd_say")
  register_clcmd("invis", "cmd_say")
  RegisterHam(Ham_Touch, "weaponbox", "fd_TouchWeapon") /*Thanks to PomanoB for the help with weaponbox and armoury_entity*/
  RegisterHam(Ham_Touch, "armoury_entity", "fd_TouchWeapon") /*Thanks to PomanoB for the help with weaponbox and armoury_entity*/
  RegisterHam(Ham_Touch, "weapon_shield", "fd_TouchWeapon")
  RegisterHam(Ham_Use, "func_button", "fd_UseButton")
  RegisterHam(Ham_Spawn, "player", "fd_PlayerSpawn_Post", 1)
  RegisterHam(Ham_Killed, "player", "fd_PlayerKilled")
  register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  register_event("DeathMsg", "event_deathmsg", "a")
  register_logevent("logevent_round_start", 2, "1=Round_Start")
  cvar_time = register_cvar("dr_fi_time", "60")
  cvar_rounds_free = register_cvar("dr_free_rounds", "3")
  cvar_rounds_invis = register_cvar("dr_invis_rounds", "3")
  cvar_free = register_cvar("dr_free", "1")
  cvar_free_health = register_cvar("dr_free_health", "0")
  cvar_invis = register_cvar("dr_invis", "1")
  cvar_invis_health = register_cvar("dr_invis_health", "200")
  cvar_hudmsgs = register_cvar("dr_fi_hudmsgs", "1")
  cvar_button = register_cvar("dr_fi_buttonused", "1")
  register_dictionary("dr_free_invis.txt")
  msgSayText = get_user_msgid("SayText")
}

public event_round_start()
{
  free = 0
  invis = 0
  remove_task(10123)
  fi_touch = 2
  rounds++
  static i
  for(i = 1; i <= 32; i++)
   button_used[i] = 0
}

public logevent_round_start()
{
  fi_touch = 1
  set_task(get_pcvar_float(cvar_time), "cant_touch", 10123)
}

public cant_touch()
  fi_touch = 0

public cmd_say(id)
{
  static arg1[128]
  read_argv(0, arg1, 127)
  remove_quotes(arg1)
  static rounds_need
  if(equal(arg1, "free") || equal(arg1, "free"))
  {
   rounds_need = last_round_free + get_pcvar_num(cvar_rounds_free) + 1
   if(!get_pcvar_num(cvar_free))
    return
   else if(get_user_team(id) != 1)
    return
   else if(!is_user_alive(id))
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_FREE_ALIVE")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(invis)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_FREE_INVIS")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(free)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_FREE_TOUCHED")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(last_round_free && (rounds_need > rounds))
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_FREE_ROUNDS", rounds_need-rounds)
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(!fi_touch)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_FREE_TIME")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(fi_touch == 2)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_FREE_SROUND")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(button_used[id] && get_pcvar_num(cvar_button))
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_FREE_BUTTONUSED")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   static i
   for(i=1; i<=32; i++)
    if(is_user_alive(i))
     if(get_user_team(i) == 2)
     {
      static ent
      ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
      if (pev_valid(ent))
      {
       dllfunc(DLLFunc_Spawn, ent)
       dllfunc(DLLFunc_Use, ent, i)
       engfunc(EngFunc_RemoveEntity, ent)
       ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "weapon_knife"))
       if (pev_valid(ent))
       {
        static Float:originF[3]
        pev(i, pev_origin, originF)
        set_pev(ent, pev_origin, originF)
        set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
        dllfunc(DLLFunc_Spawn, ent)
        static save
        save = pev(ent, pev_solid)
        dllfunc(DLLFunc_Touch, ent, i)
        if (pev(ent, pev_solid) == save)
         engfunc(EngFunc_RemoveEntity, ent)
       }
      }
     }
   if(get_pcvar_num(cvar_hudmsgs))
   {
    set_dhudmessage(2, 163, 237, 0.01, 0.50, 0, 0.5, 3.0, 0.3, 1.0, false)
    show_dhudmessage(0, "%L",0, "DR_FREE_START")
   }
   else
    client_print(0, print_center, "%L", -1, "DR_FREE_START")
   last_round_free = rounds
   free = 1
                 set_cvar_string("deathrun_mode", "FREE")
  }
  else if(equal(arg1, "invis") || equal(arg1, "invis"))
  {
   rounds_need = last_round_invis + get_pcvar_num(cvar_rounds_invis) + 1
   if(!get_pcvar_num(cvar_invis))
    return
   else if(get_user_team(id) != 1)
    return
   else if(!is_user_alive(id))
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_INVIS_ALIVE")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(free)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_INVIS_FREE")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(invis)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_INVIS_TOUCHED")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(last_round_invis && (rounds_need > rounds))
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_INVIS_ROUNDS", rounds_need-rounds)
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(!fi_touch)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_INVIS_TIME")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(fi_touch == 2)
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_INVIS_SROUND")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   else if(button_used[id] && get_pcvar_num(cvar_button))
   {
    formatex(arg1, 127, "^x04[DeathRun]^x01 %L", id, "DR_INVIS_BUTTONUSED")
    message_begin(MSG_ONE_UNRELIABLE, msgSayText, _, id)
    write_byte(id)
    write_string(arg1)
    message_end()
    return
   }
   set_pev(id, pev_health, get_pcvar_float(cvar_invis_health))
   set_pev(id, pev_renderfx, 19)
   set_pev(id, pev_rendercolor, {0.0, 0.0, 0.0})
   set_pev(id, pev_rendermode, 4)
   set_pev(id, pev_renderamt, 0.0)
   if(get_pcvar_num(cvar_hudmsgs))
   {
    set_dhudmessage(222, 73, 26, 0.01, 0.50, 0, 0.5, 3.0, 0.3, 1.0, false)
    show_dhudmessage(0, "%L",0, "DR_INVIS_START")
   }
   else
    client_print(0, print_center, "%L", -1, "DR_INVIS_START")
   last_round_invis = rounds
   invis = 1
                 set_cvar_string("deathrun_mode", "INVIS")
  }
}
public fd_TouchWeapon(ent, id)
{
  if(!is_user_alive(id) || (!free && !invis))
   return HAM_IGNORED
  static classname[16]; pev(ent, pev_classname, classname, 15)
  if(equal(classname, "weaponbox")) /*Thanks to PomanoB for the help with weaponbox and armoury_entity*/
  {
   static model[32]; pev(ent, pev_model, model, 31)
   if(get_user_team(id) == 2 && equal(model, "models/w_glock18.mdl") && !free)
    return HAM_IGNORED
  }
  return HAM_SUPERCEDE
}
public fd_UseButton(ent, caller, id)
{
  if(!is_user_alive(id))
   return HAM_IGNORED
   
  if(get_user_team(id) == 1)
  {
   if(free)
    client_print(id, print_center, "%L", id, "DR_FREE_BUTTON")
   else if(invis)
    client_print(id, print_center, "%L", id, "DR_INVIS_BUTTON")
   else
   {
    button_used[id] = 1
    return HAM_IGNORED
   }
   return HAM_SUPERCEDE
  }
  return HAM_IGNORED
}
public fd_PlayerSpawn_Post(id)
{
  if(!is_user_alive(id))
   return
   
  set_pev(id, pev_renderfx, 0)
  set_pev(id, pev_rendercolor, {255.0, 255.0, 255.0})
  set_pev(id, pev_rendermode, 0)
  set_pev(id, pev_renderamt, 16.0)
   
  if(free)
   set_task(2.0, "task_removewpn", 1024 + id)
}
public fd_PlayerKilled(id)
{
  set_pev(id, pev_renderfx, 0)
  set_pev(id, pev_rendercolor, {255.0, 255.0, 255.0})
  set_pev(id, pev_rendermode, 0)
  set_pev(id, pev_renderamt, 16.0)
}
public client_disconnect(id)
  remove_task(1024 + id)
public event_deathmsg(id)
{
  static attacker, victim
  attacker = read_data(1)
  victim = read_data(2)
  remove_task(1024 + victim)
  if(victim == attacker || !is_user_alive(attacker) || !free || !get_pcvar_num(cvar_free_health))
   return
  if(get_user_team(attacker) != 1)
   return
  set_pev(attacker, pev_health, 100.0)
}
public task_removewpn(taskid)
{
  static id; id = taskid - 1024
  static ent
  ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
  if (pev_valid(ent))
  {
   dllfunc(DLLFunc_Spawn, ent)
   dllfunc(DLLFunc_Use, ent, id)
   engfunc(EngFunc_RemoveEntity, ent)
   ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "weapon_knife"))
   if (pev_valid(ent))
   {
    static Float:originF[3]
    pev(id, pev_origin, originF)
    set_pev(ent, pev_origin, originF)
    set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
    dllfunc(DLLFunc_Spawn, ent)
    static save
    save = pev(ent, pev_solid)
    dllfunc(DLLFunc_Touch, ent, id)
    if (pev(ent, pev_solid) == save)
     engfunc(EngFunc_RemoveEntity, ent)
   }
  }
}
 
  • Страница 1 из 1
  • 1
Поиск:

AMX Mod X Russian Community © 2006-2024