SA-MP Forums Archive
Annoying Command Problem - 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)
+--- Thread: Annoying Command Problem (/showthread.php?tid=279069)



Annoying Command Problem - Compton - 25.08.2011

Hello, Well I have one annoying problem that same looking commands can be fcuked up. What I mean? Well for example I want to preform a animation I called /gasko, when im doing it I got another command coming out instead of the anim the command is /ganton (info list), I do know that it happends because of the first same 2 letters in each command and I do know that I can fix it by renaming one of the commands, But is there some other way to fix it, I mean even for example I have another info list that is called /lspd, if I will type /lspb it will still show the /lspd info thing, so sometimes it annoys. Could someone tell me if there is a way to fix it.

-Thank You.


Re: Annoying Command Problem - [MG]Dimi - 25.08.2011

I guess you are using strcmp. If so delete number in its line.
Ex.
PHP код:
if(!strcmp("/lspd",cmdtext,true,5)) //delete 5 



Re: Annoying Command Problem - eDz0r - 25.08.2011

pawn Код:
if (strcmp("/mycommand", cmdtext, false, 10) == 0)//and replace 10 with the number of caracters from ""
{
// Do something here
return 1;
}
I don't know if it will work


Re: Annoying Command Problem - Compton - 25.08.2011

Thank you Dimi, I tested it worked, lets hope it will continue working like this


Re: Annoying Command Problem - [MG]Dimi - 25.08.2011

Quote:
Originally Posted by eDz0r
Посмотреть сообщение
pawn Код:
if (strcmp("/mycommand", cmdtext, false, 10) == 0)//and replace 10 with the number of caracters from ""
{
// Do something here
return 1;
}
I don't know if it will work
Exactly what I said NOT to do. Number is optional and means "how many characters from command to match with given word?". Ex.
PHP код:
if(!strcmp("/mycommand",cmdtext,true1)) 
here we gave instruction to match only 1 character so any command that contains / m y c o a n or d which is every command coz you have / in /mycommand.