Closed noizza closed 2 years ago
Technically, you could use these functions:
native CmdArray:PC_GetCommandArray(); // to get all commands in an array
native CmdArray:PC_GetAliasArray(const cmd[]); // to get all aliases of a command in an array
native PC_GetArraySize(CmdArray:arr); // to get the number of elements of an array (all commands or all aliases array)
native PC_GetCommandName(CmdArray:arr, index, dest[], size = sizeof dest); // get the name of a command from an array, the index from 0 to n (where n is the result of PC_GetArraySize)
native PC_FreeArray(&CmdArray:arr); // to clear the array from the memory, to prevent memory leak
Then, you should be able to create a function that makes use of something like the Levenshtein Distance, which may help you to return the closest matching command name. You can see an example recently done by Y_Less here.
This may get pretty slow, I guess, especially in Pawn.
I wanted to know if it is possible to do something like this with Pawn.CMD, and if it is possible how to do it, thank you very much.
What do I mean by Guess Command? An example would be:
Sorry for my bad English.