Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSadd ghost chat


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
"ghost chat" plugin with the ability to dead can read alive's messages.
PHP Code:

#include <amxmodx>
#include <amxmisc>

new gmsgSayText;

// Return current setting or set new value
public handle_ghostchat(id,level,cid) {

    
// No switches given
    
if (read_argc() < 2) {
        new 
status[55];
         
copy(status55"Dead can read alive");  
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}

public 
handle_say(id) {

    new 
is_alive is_user_alive(id);
    new 
message[129];
    
read_argv(1,message,128);
    new 
name[33];
    
get_user_name(id,name,32);
    new 
player_count get_playersnum();
    new 
players[32];
    
get_players(playersplayer_count"c");

    
// Clients sometimes send empty messages, or a message containig a '[', ignore those.
    
if (equal(message,"")) return PLUGIN_CONTINUE;
    if (
equal(message,"[")) return PLUGIN_CONTINUE;
 
    
// Response to a specific query    
    // Format the messages, the %c (2) adds the color. The client decides what color
    // it gets by looking at team.
    
if (is_aliveformat(message127"%c%s :    %s^n"2namemessage);
    else 
format(message127"%c*DEAD*%s :    %s^n"2namemessage);

    for (new 
0player_counti++) {

      if (
is_alive && !is_user_alive(players[i])) {
         
// Talking person alive, current receiver dead
             
message_begin(MSG_ONE,gmsgSayText,{0,0,0},players[i]);
             
write_byte(id);
             
write_string(message);
             
message_end();
      }
    }
    return 
PLUGIN_CONTINUE;
}

public 
plugin_init() {
    
register_plugin("Ghostchat""0.3""NetRipper");
    
register_clcmd("say""handle_say");
    
register_concmd("amx_ghostchat""handle_ghostchat",-1,"<mode>");

    
gmsgSayText get_user_msgid("SayText");

    return 
PLUGIN_CONTINUE;


My random name chat plugin:
PHP Code:

#include <amxmodx>
#include <murdermod>

new const g_szOldChannels[][] = 
{
  
"#Cstrike_Chat_CT",
  
"#Cstrike_Chat_T",
  
"#Cstrike_Chat_CT_Dead",
  
"#Cstrike_Chat_T_Dead",
  
"#Cstrike_Chat_Spec",
  
"#Cstrike_Chat_All",
  
"#Cstrike_Chat_AllDead",
  
"#Cstrike_Chat_AllSpec"
};

new const 
g_szNewChannels[][] =
{
  
"(Counter-Terrorist) ",
  
"(Terrorist) ",
  
"*DEAD*(Counter-Terrorist) ",
  
"*DEAD*(Terrorist) ",
  
"(Spectator) ",
  
"",
  
"*ÖLÜ* ",
  
"*SPEC* "
};

public 
plugin_init()
{
  
register_plugin("[MM] Chat messages"MM_VERSIONMM_AUTHOR);
  
register_message(get_user_msgid("SayText"), "Message_SayText");
  
register_clcmd("say_team""hook_sayteam");
}

public 
Message_SayText(msgiddestid)
{
  new 
sender get_msg_arg_int(1);
  if(!
is_user_alive(sender) || mm_get_gamemode() != GAME_STARTED)
    return 
PLUGIN_CONTINUE;

  static 
channel[64];
  
get_msg_arg_string(2channelcharsmax(channel));
  new 
i;
  for(
0sizeof g_szOldChannelsi++)
    if(
equal(channelg_szOldChannels[i]))
      break;

  static 
message[192];
  
get_msg_arg_string(4messagecharsmax(message));
  
remove_quotes(message);
  
client_print_color(idprint_team_default"%s%s ^x01:  %s"g_szNewChannels[i], get_name(sender), message);

  return 
PLUGIN_HANDLED;
}

public 
hook_sayteam(id)
{
  if(
is_user_alive(id))
    return 
PLUGIN_HANDLED;

  return 
PLUGIN_CONTINUE;


I want to edit my plugin in a way that the dead can read the messages of the living, similar to ghost chat. The living will not see the messages of the dead, I only want the dead to see the message of the living as an extra.

I tried to do it, but the dead see the message of the living more than once. Like
John:Hi
John:Hi
PHP Code:

#include <amxmodx>
#include <murdermod>
#include <amxmisc>
new gmsgSayText;
new const 
g_szOldChannels[][] = 
{
  
"#Cstrike_Chat_CT",
  
"#Cstrike_Chat_T",
  
"#Cstrike_Chat_CT_Dead",
  
"#Cstrike_Chat_T_Dead",
  
"#Cstrike_Chat_Spec",
  
"#Cstrike_Chat_All",
  
"#Cstrike_Chat_AllDead",
  
"#Cstrike_Chat_AllSpec"
};

new const 
g_szNewChannels[][] =
{
  
"(Counter-Terrorist) ",
  
"(Terrorist) ",
  
"*DEAD*(Counter-Terrorist) ",
  
"*DEAD*(Terrorist) ",
  
"(Spectator) ",
  
"",
  
"*ÖLÜ* ",
  
"*SPEC* "
};

public 
plugin_init()
{
  
gmsgSayText get_user_msgid("SayText");
  
register_plugin("[MM] Chat messages"MM_VERSIONMM_AUTHOR);
  
register_message(get_user_msgid("SayText"), "Message_SayText");
  
register_clcmd("say_team""hook_sayteam");
  return 
PLUGIN_CONTINUE;
}

public 
Message_SayText(msgiddestid)
{
   new 
sender get_msg_arg_int(1);
   if(!
is_user_alive(sender) || mm_get_gamemode() != GAME_STARTED)
    return 
PLUGIN_CONTINUE;

   static 
channel[64];
   
get_msg_arg_string(2channelcharsmax(channel));
   new 
i;
   for(
0sizeof g_szOldChannelsi++)
   if(
equal(channelg_szOldChannels[i]))
   break;

   static 
message[192];
   
get_msg_arg_string(4messagecharsmax(message));
   
remove_quotes(message);
   
client_print_color(idprint_team_default"%s%s ^x01:  %s"g_szNewChannels[i], get_name(sender), message);

   new 
is_alive is_user_alive(id);
   new 
message1[192];
   
read_argv(1,message1,charsmax(message1));
  
/* new player_count = get_playersnum();
   new players[32];
   get_players(players, player_count, "ch");  */

  

   
if (equal(message1,"")) return PLUGIN_CONTINUE;
   
// if (equal(message1,"[")) return PLUGIN_CONTINUE; 
    //if (is_alive) format(message, 127, "%c%s :    %s^n", 2, name, message);
   
if (is_aliveformat(message1127"%s%s :    %s^n"g_szNewChannels[i], get_name(sender), message1);
   else 
format(message1127"*ÖLÜ*%s%s:  %s^n"g_szNewChannels[i], get_name(sender), message1);
   
//for (new i = 0; i < player_count; i++) {
   
new numit;
   static 
players[32];
   
get_players(playersnum);

  for(--
numnum >= 0num--)
    {
  
it players[num];

  if (
is_alive && !is_user_alive(it)) {
             
message_begin(MSG_ONE,gmsgSayText,{0,0,0},it);
             
write_byte(id);
             
write_string(message1);
             
message_end();
             break;

      }
    }
   return 
PLUGIN_HANDLED;
}


public 
hook_sayteam(id)
{
  if(
is_user_alive(id))
    return 
PLUGIN_HANDLED;

  return 
PLUGIN_CONTINUE;


Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...