AMX MOD X
Четверг, 28.03.2024, 11:21:53



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

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

  • Страница 1 из 1
  • 1
Модератор форума: slogic, AlMod  
AMX Mod X Форум » Скриптинг » Помощь по скриптингу » Admin Listen
Admin Listen
TerДата: Вторник, 04.08.2009, 20:00:57 | Сообщение # 1
Майор
Группа: Пользователи
Сообщений: 83
Репутация: 0
Статус: Не в сети
Можно сделать, чтобы все всё видели. %) (ну чтобы все игроки видели чат и через "у" и через "u" и наблюдатель)

Code
#include <amxmodx>
#include <amxmisc>
#include <engine>

// Counter for the SayText event.
new count[32][32]      
new g_voice_status[2]

public catch_say(id)
{
  new reciever = read_data(0) //Reads the ID of the message recipient
  new sender = read_data(1)   //Reads the ID of the sender of the message
  new message[151]            //Variable for the message
  new channel[151]
  new sender_name[32]

  if (is_running("czero")||is_running("cstrike"))
  {
      read_data(2,channel,150)
      read_data(4,message,150)
      get_user_name(sender, sender_name, 31)
  } else {
          read_data(2,message,150)
  }
     
  // DEBUG.  
  // console_print(0, "DEBUG MESSAGE: %s", message)
  // console_print(0, "DEBUG channel: %s", channel)
  // console_print(0, "DEBUG sender: %s, %i", sender_name, sender)
  // console_print(0, "DEBUG receiver: %i", reciever)
     
     //With the SayText event, the message is sent to the person who sent it last.
     //It's sent to everyone else before the sender recieves it.

  // Keeps count of who recieved the message
     count[sender][reciever] = 1           
  // If current SayText message is the last then...
     if (sender == reciever)
  {       
         new player_count = get_playersnum()  //Gets the number of players on the server
         new players[32] //Player IDs
         get_players(players, player_count, "c")

         for (new i = 0; i < player_count; i++)  
   {
    // If the player is an admin...
            if (get_user_flags(players[i]) & ADMIN_LEVEL_B)
    {      
     // If the player did not recieve the message then...
                if (count[sender][players[i]] != 1)
     {               
                    message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])
                    // Appends the ID of the sender to the message, so the engine knows what color to make the name.
                    write_byte(sender)
                    // Appends the message to the message (depending on the mod).
      if (is_running("czero")||is_running("cstrike"))
             {
          write_string(channel)
              write_string(sender_name)
             }
                    write_string(message)
                    message_end()
                }
            }
            count[sender][players[i]] = 0  //Set everyone's counter to 0 so it's ready for the next SayText
         }
     }
   
     return PLUGIN_CONTINUE
}

public plugin_init(){
    register_plugin("AdminListen","2.3x","/dev/ urandom")
    register_srvcmd("amx_adminlisten_voice","voice_status")
    register_event("SayText","catch_say","b")
    return PLUGIN_CONTINUE
}

public plugin_modules(){
    require_module("engine")  
}

// *********************
// VoiceComm Stuff
// *********************

public client_infochanged(id)
{
    if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1")) set_speak(id, 4)
}

public client_connect(id)
{
    if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1")) set_speak(id, 4)
}

public voice_status(){
    read_argv(1,g_voice_status,1)
    new player_count = get_playersnum()
    new players[32] //Player IDs
    get_players(players, player_count, "c")
    for (new i = 0; i < player_count; i++) {
       if ((get_user_flags(players[i]) & ADMIN_LEVEL_B)){          
          if (equal(g_voice_status,"0")) set_speak(players[i], 0)
          if (equal(g_voice_status,"1")) set_speak(players[i], 4)
       }
    }
}
 
defaultNick8433Дата: Вторник, 04.08.2009, 20:03:04 | Сообщение # 2
Генерал-полковник
Группа: Скриптеры
Сообщений: 806
Репутация: 19
Статус: Не в сети
MSG_ONE поменяй на MSG_ALL

Раскручиваю сайты,ставлю трекера на хостинг.Всё бесплатно.Если заинтересовало,то моя аська 400538001
 
TerДата: Вторник, 04.08.2009, 21:25:05 | Сообщение # 3
Майор
Группа: Пользователи
Сообщений: 83
Репутация: 0
Статус: Не в сети
Не работает а ADMIN_LEVEL_B на ADMIN_LEVEL_Z не надо
 
AMX Mod X Форум » Скриптинг » Помощь по скриптингу » Admin Listen
  • Страница 1 из 1
  • 1
Поиск:

AMX Mod X Russian Community © 2006-2024