Raised This Month: $ Target: $400

Command Arg without quotes

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Junior Member
Join Date: Aug 2016
Old 08-11-2016 , 02:19   Command Arg without quotes
Reply With Quote #1


I created a command which takes one argument and prints this argument to the chat.

PHP Code:
public Action:chatCommand(clientargs) {
args 1) {
PrintToConsole(client"usage: chatmessage <message>");



PrintToChatAll("Admin: %s"Arg1);

If I use the command like
PHP Code:
chatmessage "this is my message" 
it prints the whole message.

But if I do
PHP Code:
chatmessage this is my message 
it splits at the first space and only prints "Admin: this".

Is there any way to fix this? Thank you very much for your help!
aequabit is offline
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 08-11-2016 , 03:30   Re: Command Arg without quotes
Reply With Quote #2

If they quote it, it's one argument. If they don't, it's multiple. This is useful in some cases to make parsing much easier if you have multiple parameters but at least one can contain spaces.

If you don't care about the difference, you can just use GetCmdArgString().
Fyren is offline
Veteran Member
Join Date: Nov 2012
Location: void
Old 08-11-2016 , 18:20   Re: Command Arg without quotes
Reply With Quote #3

Use GetCmdArgString
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline

Thread Tools
Display Modes

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 22:17.

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