SA-MP Forums Archive
Did you mean...? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Did you mean...? (/showthread.php?tid=240964)



Did you mean...? - grand.Theft.Otto - 17.03.2011

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?


Re: Did you mean...? - Marricio - 17.03.2011

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.


Re: Did you mean...? - grand.Theft.Otto - 17.03.2011

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 ' ?


AW: Did you mean...? - XCarBOn - 17.03.2011

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

https://sampwiki.blast.hk/wiki/Strfind


Re: Did you mean...? - grand.Theft.Otto - 17.03.2011

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

It does seem hard to find the nearest command.