AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can't find string in buffer (https://forums.alliedmods.net/showthread.php?t=299456)

eyal282 07-15-2017 06:44

Can't find string in buffer
 
PHP Code:


/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "FuckTheSchool ( Eyal282 )"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_message(get_user_msgid("SayText"), "message_SayText");
}

public 
message_SayText(msgidsomethingid)
{    
    
// 1 = id, 2 = Contains Terrorist or Spectator if team chat, 3 = message sent.
    
new Message[256], PerhapsTeam[100];
    
    
get_msg_arg_string(2PerhapsTeam99);
    
get_msg_arg_string(4Messagecharsmax(Message));

    
    new 
bool:TeamChat;
    
    if(
containi(PerhapsTeam"Terr") != -1)
    {
        
TeamChat true;
        
        
client_print(idprint_chat"BOIII");
    }
    
    else
        
client_print(idprint_chatPerhapsTeam);


Output:

Code:

(Terrorist)  :

PRoSToTeM@ 07-15-2017 07:05

Re: Can't find string in buffer
 
Because it is #Cstrike_Chat_T.

eyal282 07-15-2017 08:11

Re: Can't find string in buffer
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2535457)
Because it is #Cstrike_Chat_T.

Thanks. Unrelated, I'm trying to remake the chat with a plugin.

How can I use ^2 when it also colors *DEAD* and (Terrorist) and it only works on the beginning of the ColorChat?

Natsheh 07-15-2017 09:15

Re: Can't find string in buffer
 
Quote:

Originally Posted by eyal282 (Post 2535465)
Thanks. Unrelated, I'm trying to remake the chat with a plugin.

How can I use ^2 when it also colors *DEAD* and (Terrorist) and it only works on the beginning of the ColorChat?

there is no ^2

just ^1 is the default color chat. ( YELLOW )

& ^4 is green
& ^3 is team color

eyal282 07-15-2017 09:38

Re: Can't find string in buffer
 
Quote:

Originally Posted by Natsheh (Post 2535480)
there is no ^2

just ^1 is the default color chat. ( YELLOW )

& ^4 is green
& ^3 is team color

The effects ^2 has disagree with your opinion. It changes color.

PRoSToTeM@ 07-15-2017 10:10

Re: Can't find string in buffer
 
STX works the same as in HL. https://github.com/ValveSoftware/hal....cpp#L202-L218

eyal282 07-15-2017 10:17

Re: Can't find string in buffer
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2535499)

Uhh... That's not even AmxModX language.

Solved:

PHP Code:

public message_SayText(msgidsomethingid)
{
    new 
Message[256], MessageTags[40];
    
get_msg_arg_string(2MessageTagscharsmax(MessageTags));
    
get_msg_arg_string(4Messagecharsmax(Message));    

    
formatex(Formatcharsmax(Format), "%s %s"MessageTagsMessage);
        
    
ColorChat(iFormat);
}

stock ColorChat(const index, const string[], {FloatSqlResul,_}:...) 
{    
    if(!
index) return 1;
    
    if(
is_user_connected(index))
    {
        
        static 
SayText;
        
        if(!
SayText)
            
SayText get_user_msgid("SayText");
            
        
message_begin(MSG_ONE_UNRELIABLESayText,_index);
        
write_byte(index);
        
write_string(string);
        
message_end();
    }
    return 
1;



Natsheh 07-16-2017 05:07

Re: Can't find string in buffer
 
Quote:

Originally Posted by eyal282 (Post 2535501)
Uhh... That's not even AmxModX language.

Solved:

[php]
public message_SayText(msgid, something, id)
{
new Message[256], MessageTags[40];
get_msg_arg_string(2, MessageTags, charsmax(MessageTags));
get_msg_arg_string(4, Message, charsmax(Message));

formatex(Format, charsmax(Format), "%s %s", MessageTags, Message);

ColorChat(i, Format);
}

stock ColorChat(const index, const string[], {Float, Sql, Resul,_}:...)
{
if(!index) return 1;

if(is_user_connected(index))
{

static SayText;

if(!SayText)
SayText = get_user_msgid("SayText");

message_begin(MSG_ONE_UNRELIABLE, SayText,_, index);
write_byte(index);
write_string(string);
message_end();
}
return 1;
}

Theres no such a thing called amx modx language its called pawn and this is a module language which will be using C++ or else..


All times are GMT -4. The time now is 23:11.

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