AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Vip Chat (https://forums.alliedmods.net/showthread.php?t=327342)

GaBy96 09-13-2020 02:32

Vip Chat
 
Hello! i want this plugin to go through say_team * like admin chat say_team @.

Code:

/* VSVipChat v1.3

Description:
        Adds a private chat for vips.
Access flag by default:
        VIP_FLAG_F.
Type:
        Constant.
Commands:
        say_vip - say in VIP chat.
Note:
        bind "<button>" "messagemode say_vip"
*/

#include <amxmodx>
#include <VIPSystem>

#define ACCESS_FLAG VIP_FLAG_F

new msgidSayText, maxPlayers;

public plugin_init()
{
        register_plugin("VSVipChat", "1.3", "ZETA [M|E|N]");
       
        msgidSayText = get_user_msgid("SayText");
        maxPlayers = get_maxplayers();
       
        register_clcmd("say_vip", "ClcmdSayVip", ADMIN_ALL, "");
}

public ClcmdSayVip(id)
{
        if (!VSGetVipFlag(id, ACCESS_FLAG))
        {
                return PLUGIN_HANDLED;
        }
       
        new name[32];
        get_user_name(id, name, charsmax(name));
       
        new message[64];
        read_args(message, charsmax(message));
        remove_quotes(message);
       
        new chat[64];
        if (is_user_alive(id))
        {
                chat = "(VIP) %s1 :  %s2";
        }
        else
        {
                chat = "*DEAD*(VIP) %s1 :  %s2";
        }
       
        ClientPrint(chat, name, message);
        return PLUGIN_HANDLED;
}

public ClientPrint(chat[], name[], message[])
{
        for (new id = 1; id <= maxPlayers; ++id)
        {
                if (VSGetVipFlag(id, ACCESS_FLAG))
                {
                        message_begin(MSG_ONE, msgidSayText, _, id);
                        write_byte(id);
                        write_string(chat);
                        write_string(name);
                        write_string(message);
                        message_end();
                }
        }
}


Shadows Adi 09-13-2020 05:36

Re: Vip Chat
 
Code:

register_clcmd("say_vip", "ClcmdSayVip", ADMIN_ALL, "");
-->>
Code:

register_clcmd("say_team !", "ClcmdSayVip", ADMIN_ALL, "");
This should work with '!' symbol instead '@'

GaBy96 09-13-2020 06:29

Re: Vip Chat
 
I tried

Code:

register_clcmd("say_team *", "ClcmdSayVip", ADMIN_ALL, "");
but it doesn't work you have to write in the console say_team * message

artYY 09-13-2020 11:05

Re: Vip Chat
 
Something with * should blocking your code. Try to say something with * to test

GaBy96 09-13-2020 11:42

Re: Vip Chat
 
https://i.imgur.com/FokcbgS.png
Code:

register_clcmd("say_team !", "ClcmdSayVip", ADMIN_ALL, "");
Don't work.


Quote:

Originally Posted by artYY (Post 2717663)
Something with * should blocking your code. Try to say something with * to test

I tried and it gives me in the team chat exactly as I write with * at the beginning

artYY 09-13-2020 12:01

Re: Vip Chat
 
Try to put the plugin on the first of 3rd party. It could be some plugin changing the code.

drakunovu6 09-13-2020 12:13

Re: Vip Chat
 
Didn't test it but try this one, uses the method of adminchat.sma but with the *, vip flags and say if it's dead or not

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <VIPSystem>

#define ACCESS_FLAG VIP_FLAG_F

public plugin_init() 
{
    
register_plugin("VSVipChat""1.3""ZETA [M|E|N]");
    
register_clcmd("say_team""cmdSayVip"ADMIN_ALL"");
}

public 
cmdSayVip(id)
{
    new 
said[2];
    
read_argv(1said1);
    
    if (
said[0] != '*' || !VSGetVipFlag(idACCESS_FLAG))
        return 
PLUGIN_CONTINUE;
    
    new 
message[192], name[32];
    new 
players[32], inum;
    
    
read_args(message191);
    
remove_quotes(message);
    
get_user_name(idname31);
    
    
format(message191"%s(VIP) %s :  %s"is_user_alive(id) ? "" "*DEAD* "namemessage[1]);

    
get_players(playersinum)
    
    for (new 
0inum; ++i)
    {
        if (
players[i] != id && VSGetVipFlag(idACCESS_FLAG))
            
client_print(players[i], print_chat"%s"message);
    }
    
    
client_print(idprint_chat"%s"message);

    return 
PLUGIN_HANDLED;



GaBy96 09-13-2020 13:51

Re: Vip Chat
 
Quote:

Originally Posted by drakunovu6 (Post 2717673)
Didn't test it but try this one, uses the method of adminchat.sma but with the *, vip flags and say if it's dead or not

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <VIPSystem>

#define ACCESS_FLAG VIP_FLAG_F

public plugin_init() 
{
    
register_plugin("VSVipChat""1.3""ZETA [M|E|N]");
    
register_clcmd("say_team""cmdSayVip"ADMIN_ALL"");
}

public 
cmdSayVip(id)
{
    new 
said[2];
    
read_argv(1said1);
    
    if (
said[0] != '*' || !VSGetVipFlag(idACCESS_FLAG))
        return 
PLUGIN_CONTINUE;
    
    new 
message[192], name[32];
    new 
players[32], inum;
    
    
read_args(message191);
    
remove_quotes(message);
    
get_user_name(idname31);
    
    
format(message191"%s(VIP) %s :  %s"is_user_alive(id) ? "" "*DEAD* "namemessage[1]);

    
get_players(playersinum)
    
    for (new 
0inum; ++i)
    {
        if (
players[i] != id && VSGetVipFlag(idACCESS_FLAG))
            
client_print(players[i], print_chat"%s"message);
    }
    
    
client_print(idprint_chat"%s"message);

    return 
PLUGIN_HANDLED;




Thanks but it doesn't work

drakunovu6 09-13-2020 13:54

Re: Vip Chat
 
Quote:

Originally Posted by GaBy96 (Post 2717688)
Thanks but it doesn't work

What it's the problem? I did test it a bit in localhost with HLDS without Admin and if I used the "say_team *hi" it says "(Counter-Terrorist) Drakunovu : hi" but if I had Admin it works, I removed the VSGetVipFlag and changed it to a flag of admin and it worked.

GaBy96 09-13-2020 14:19

Re: Vip Chat
 
Quote:

Originally Posted by drakunovu6 (Post 2717689)
What it's the problem? I did test it a bit in localhost with HLDS without Admin and if I used the "say_team *hi" it says "(Counter-Terrorist) Drakunovu : hi" but if I had Admin it works, I removed the VSGetVipFlag and changed it to a flag of admin and it worked.

Yes, but I want to use it for vip and if you have a vip degree it doesn't show you a message in vip chat but in team chat


All times are GMT -4. The time now is 19:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.