x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Custom console function

Hello all !

I have a little problem, I'm unable to create a console command with parameters inplementable in blueprints ... I know how to create them without being in the console, how to make them in the console and BP without parameter, but when I had one the function isn't compilable ... It may be something like this, but it doesn't want to compile ...

 UFUNCTION(Exec, BlueprintImplementableEvent, Category = "CmdAdmin")
 void Kick(FString PlayerName);

I tried to replace FString with FString&, same error, I tried to add virtual, it says I shouldn't use virtual,

Please, it would be for something like "kick john" and john go out ...

Thank you for reading !

Product Version: UE 4.11
Tags:
more ▼

asked May 09 '16 at 08:52 PM in C++ Programming

avatar image

mdonge
830 31 12 39

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi mdonge,

Looking at the documentation on the Console Manager makes it look like the Exec-style of console commands may be deprecated. That said, it also lead me to an answer: If you want arguments, you can use a function like this:

 UFUNCTION(Exec, Category = "Console Command")
 void Kick(const TArray<FString>& Players);

Then you can either enforce that only one player is given (e.g. not kick anyone and report an error if multiple players are specified) or iterate over the list kicking each player in turn.

For reference, you might also look at the information for IConsoleManager::RegisterConsoleCommand and/or FAutoConsoleCommands, since those appear to be the preferred way of setting up console commands. I wasn't able to find quite all the documentation I'd like for them (esp. on the FConsoleCommandDelegate and related structures), but a quick "Go to definition" in Visual Studio let me infer what I needed.

Please let me know if this helps!

-Roomon1

more ▼

answered May 10 '16 at 12:19 AM

avatar image

roomon1
191 4 5 11

avatar image mdonge May 10 '16 at 08:10 AM

thanks ! I will look at this ;) I saw that they are deprecated, but I hope there was some workaround...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question