AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with hide player say again. (https://forums.alliedmods.net/showthread.php?t=134378)

GarbageBox 08-04-2010 01:02

Help with hide player say again.
 
I`m trying to write a plugin to my friend, A basic chat format in cs.
He say he want to change sth.
But when I finish it, I found some problems.
The plugin can not hide what player say.
This is already in the order plugin to hide player say, but it`s not work. > return PLUGIN_HANDLED
So I decided to post my code in here and want some helps.
Please correct my code if these is sth wrong.
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN_NAME        "Basic Chat Format"
#define PLUGIN_VERSION        "1.0"
#define PLUGIN_AUTHOR        "NoName"

new players[33][32]
new num[33]

public plugin_init()
{
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
        register_clcmd("say", "hook_say")
        register_clcmd("say_team", "hook_team_say")
}

public hook_say(id)
{
        new chat[192]
        read_args(chat, 191)
        remove_quotes(chat)
       
        new name[32], message[256]
        get_user_name(id, name, 31)
       
        new CsTeams:userteam =cs_get_user_team(id)
        if(equal(chat, ""))
                return PLUGIN_HANDLED_MAIN
       
        if (is_user_alive(id))
        {
                format(message, 255, "^x03%s ^x01: %s", name, chat)
                color_chat(0, id, message)
        }
        else if (!is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
        {
                format(message, 255, "^x01*DEAD* ^x03%s ^x01: %s", name, chat)
                color_chat(0, id, message)
        }
        else
        {
                format(message, 255, "^x01*SPEC* ^x03%s ^x01: %s", name, chat)
                color_chat(0, id, message)
        }
        return PLUGIN_CONTINUE
}

public hook_team_say(id)
{
        new chat[192]
        read_args(chat, 191)
        remove_quotes(chat)
       
        new name[32], message[256], team[32]
        get_user_name(id, name, 31)
       
        if(equal(chat, ""))
                return PLUGIN_HANDLED_MAIN
       
        new CsTeams:userteam =cs_get_user_team(id)
        if (userteam == CS_TEAM_T)
        {
                get_players(players[id], num[id], _, "TERRORIST")
                team = "(TR)"
        }
        else if (userteam == CS_TEAM_CT)
        {
                get_players(players[id], num[id], _, "CT")
                team = "(CT)"
        }
        else
        {
                get_players(players[id], num[id], _, "SPECTATOR")
                team = "(SPEC)"
        }
        for (new a = 0; a < num[id]; ++a)
        {
                new i = players[id][a]
                if (is_user_alive(id))
                {
                        format(message, 255, "^x03%s %s ^x01: %s", team, name, chat)
                        color_chat(i, id, message)
                }
                else if (!is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
                {
                        format(message, 255, "^x01*DEAD*^x03%s %s ^x01: %s", team, name, chat)
                        color_chat(i, id, message)
                }
                else
                {
                        format(message, 255, "^x03%s %s ^x01: %s", team, name, chat)
                        color_chat(i, id, message)
                }
        }
        return PLUGIN_CONTINUE
}

public color_chat(playerid, colorid, message[])
{
        message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0, 0, 0}, playerid)
        write_byte(colorid)
        write_string(message)
        message_end()
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg936\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/


fysiks 08-04-2010 02:27

Re: Help with hide player say again.
 
Quote:

Originally Posted by GarbageBox (Post 1261181)
return PLUGIN_HANDLED


GarbageBox 08-04-2010 02:34

Re: Help with hide player say again.
 
I have tried change all to return PLUGIN_HANDLED, but it will make other say command not work.
Just say /admin, it won`t show anything.

fysiks 08-04-2010 02:36

Re: Help with hide player say again.
 
Quote:

Originally Posted by GarbageBox (Post 1261227)
I have tried change all to return PLUGIN_HANDLED, but it will make other say command not work.
Just say /admin, it won`t show anything.

Then put this plugin as the last plugin in the plugins.ini. iirc

GarbageBox 08-04-2010 03:04

Re: Help with hide player say again.
 
OKay.
It`s fixed now.
Thank for your help!
I`ve a question, how to make a plugin that admin could not close in the plugin menu

fysiks 08-04-2010 13:28

Re: Help with hide player say again.
 
Quote:

Originally Posted by GarbageBox (Post 1261236)
I`ve a question, how to make a plugin that admin could not close in the plugin menu

What???? Sounds unrelated to this topic. New question = new thread.


All times are GMT -4. The time now is 00:17.

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