Raised This Month: $32 Target: $400
 8% 

[TF2] Admin warning (v1.7, 22/10/2017)


Post New Thread Reply   
 
Thread Tools Display Modes
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 10-17-2017 , 15:22   Re: [TF2] Admin warning (v1.1, 17/10/2017)
Reply With Quote #11

Quote:
Originally Posted by 91346706501435897134 View Post
To send a message using more words you need to put the message in parentheses.
example: sm_send_warning x "hello x"
Or you could get all the arguments and remove the first one (target), so end-user don't have to use the ' " ' !

EDIT:
Quick idea, not tested :
PHP Code:
char arg1[MAX_NAME_LENGTH+1];
char message[100];
char arg2[102];
    
if (
args 2)
{
    
ReplyToCommand(client"Usage: sm_send_warning <name|#userid> <message>");
    return 
Plugin_Handled;
}
    
GetCmdArg(1arg1sizeof(arg1));
StrCat(arg1sizeof(arg1), " ");
    
GetCmdArgString(messagesizeof(message));
ReplaceString(messagesizeof(message), arg1"");

PrintToChat(client"Message : %s"message); 
You can probably make this more efficient, but I bet you got the idea.
__________________
Want to check my plugins ?

Last edited by Arkarr; 10-17-2017 at 15:29.
Arkarr is offline
91346706501435897134
Member
Join Date: Oct 2017
Old 10-17-2017 , 16:01   update 1.2
Reply With Quote #12

update 1.2

Quote:
* Now plays a sound to the target when the message is sent.

Last edited by 91346706501435897134; 10-17-2017 at 19:14.
91346706501435897134 is offline
Scag
AlliedModders Donor
Join Date: May 2017
Location: Crashing Hale
Old 10-17-2017 , 21:04   Re: [TF2] Admin warning (v1.2, 17/10/2017)
Reply With Quote #13

In order to convey a multi-arg'd message you need to use this preferably

Code:
        char sMessage[256], sBuffer[64];
	if (args > 1)
	{
		GetCmdArg(2, sMessage, sizeof(sMessage));
		for (int i = 2; i <= args; i++) //i believe i starts at 2 but im not sure
		{
			GetCmdArg(i, sBuffer, sizeof(sBuffer));
			Format(sMessage, sizeof(sMessage), "%s %s", sMessage, sBuffer);
		}
	}
This formats the char 'sMessage' as the entirety of all the args minus 'target' which is why 'i' starts at 2. Although 'i' may be 1 i haven't tested.
But doing this allows you to /send_warning <target> 'whatever words you please' without having to use console
__________________
Over-engineering is underrated.

GitHub
BTC
ETH

Retired
Scag is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 10-18-2017 , 02:40   Re: [TF2] Admin warning (v1.2, 17/10/2017)
Reply With Quote #14

Quote:
Originally Posted by Ragenewb View Post
In order to convey a multi-arg'd message you need to use this preferably

Code:
        char sMessage[256], sBuffer[64];
	if (args > 1)
	{
		GetCmdArg(2, sMessage, sizeof(sMessage));
		for (int i = 2; i <= args; i++) //i believe i starts at 2 but im not sure
		{
			GetCmdArg(i, sBuffer, sizeof(sBuffer));
			Format(sMessage, sizeof(sMessage), "%s %s", sMessage, sBuffer);
		}
	}
This formats the char 'sMessage' as the entirety of all the args minus 'target' which is why 'i' starts at 2. Although 'i' may be 1 i haven't tested.
But doing this allows you to /send_warning <target> 'whatever words you please' without having to use console
Yeah, that's definitly better +1 !
__________________
Want to check my plugins ?
Arkarr is offline
91346706501435897134
Member
Join Date: Oct 2017
Old 10-18-2017 , 06:16   Re: [TF2] Admin warning (v1.2, 17/10/2017)
Reply With Quote #15

Quote:
Originally Posted by Ragenewb View Post
In order to convey a multi-arg'd message you need to use this preferably

Code:
        char sMessage[256], sBuffer[64];
	if (args > 1)
	{
		GetCmdArg(2, sMessage, sizeof(sMessage));
		for (int i = 2; i <= args; i++) //i believe i starts at 2 but im not sure
		{
			GetCmdArg(i, sBuffer, sizeof(sBuffer));
			Format(sMessage, sizeof(sMessage), "%s %s", sMessage, sBuffer);
		}
	}
This formats the char 'sMessage' as the entirety of all the args minus 'target' which is why 'i' starts at 2. Although 'i' may be 1 i haven't tested.
But doing this allows you to /send_warning <target> 'whatever words you please' without having to use console
Turned out i needed to be 3
91346706501435897134 is offline
91346706501435897134
Member
Join Date: Oct 2017
Old 10-18-2017 , 06:42   update 1.3
Reply With Quote #16

update 1.3

Quote:
* Putting your message in parentheses if using more words is no longer needed.
91346706501435897134 is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 10-18-2017 , 11:32   Re: [TF2] Admin warning (v1.3, 18/10/2017)
Reply With Quote #17

As a suggestion, I would probably change the default admin flag to ADMFLAG_CHAT rather than ADMFLAG_SLAY. Makes sense since this is a more chat orientated thing to use.
ThatKidWhoGames is offline
91346706501435897134
Member
Join Date: Oct 2017
Old 10-18-2017 , 11:49   Re: [TF2] Admin warning (v1.3, 18/10/2017)
Reply With Quote #18

Quote:
Originally Posted by ThatKidWhoGames View Post
As a suggestion, I would probably change the default admin flag to ADMFLAG_CHAT rather than ADMFLAG_SLAY. Makes sense since this is a more chat orientated thing to use.
Thanks, changing that in next update.
91346706501435897134 is offline
91346706501435897134
Member
Join Date: Oct 2017
Old 10-18-2017 , 11:58   update 1.4
Reply With Quote #19

update 1.4

Quote:
18/10/2017 (v1.4)

* Minor code improvements.
* sm_send_warning now requires ADMFLAG_CHAT (old flag: ADMFLAG_SLAY).

Last edited by 91346706501435897134; 10-18-2017 at 19:15.
91346706501435897134 is offline
91346706501435897134
Member
Join Date: Oct 2017
Old 10-18-2017 , 19:14   update 1.5
Reply With Quote #20

update 1.5
Quote:
19/10/2017 (v1.5)

* Added ConVar sm_admin_warning_play_sound
91346706501435897134 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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