AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Player say message? (https://forums.alliedmods.net/showthread.php?t=252682)

Guxi 12-07-2014 10:37

[HELP] Player say message?
 
I need to take player's SAY message. For example;
Player write's a message on chat -> say: "!632" generally it's in this format: "!n"
I have to be able to recognize that number "n" / (e.g."632) ", how can i do that?
Since i'm not expecting a static message like "!command", but rather dynamic input such as "!n", but n can be any INT value.

Thank you for your time in advance!

Flick3rR 12-07-2014 10:57

Re: [HELP] Player say message?
 
You may catch the "say" or "say_team" command (or both). Then you read_args() with some string. The you can check if szArgs[0] == '!', and if so, get the rest after the ! mark. You can do it using the following string - szArgs[0].

HamletEagle 12-07-2014 11:45

Re: [HELP] Player say message?
 
Code:
register_clcmd("say", "ClientCommandSay") register_clcmd("say_team", "ClientCommandSay") public ClientCommandSay(id) {     new PlayerMessage[192]     read_args(PlayerMessage, charsmax(PlayerMessage))     remove_quotes(PlayerMessage)         if(PlayerMessage[0] == '!')     {         format(PlayerMessage, charsmax(PlayerMessage), "%s", PlayerMessage[1])         new Number = str_to_num(PlayerMessage)     } }
Something like that..


All times are GMT -4. The time now is 15:20.

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