Did you mean...?
#1

I have a /dm teleport. Say someone type /fdm as a typing error/mistake.

How can I make it return an error saying "Invalid Command. Did You Mean ' /dm ' ?"

Something like that ^.

Anyone know?
Reply
#2

with strcmp
pawn Код:
if(strcmp(cmdtext,"/fdm",true,))
{
SendClientMessage(playerid,COLOR,"Did you mean ' /dm ' ?");
return 1;
}
with zcmd
pawn Код:
CMD:fdm(playerid,params[])
{
SendClientMessage(playerid,COLOR,"Did you mean ' /dm ' ?");
return 1;
}
Sorry for identation.
Reply
#3

Nooo, like how can I do it so if it was a word or letters very close to /dm, it will return that error, not an actual command /fdm. like:

Type /gfdm or /ddm or /md it will return Invalid Command. Did You Mean ' /dm ' ?
Reply
#4

It's really difficult. But maybe this function can help you:

https://sampwiki.blast.hk/wiki/Strfind
Reply
#5

Ah, thanks ****** and XCarbon.

It does seem hard to find the nearest command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)