SA-MP Forums Archive
help with strcmp - 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: help with strcmp (/showthread.php?tid=499135)



help with strcmp - AroseKhanNiazi - 06.03.2014

if(!strcmp(name, "Sasuke_Uchiha", true)) how can i add 2 or more names like sasuke_uchiha can use this cmd too and arose can too


Re: help with strcmp - BKarner - 06.03.2014

if(!strcmp(name, "Sasuke_Uchiha", true) || !strcmp(name, "", true))

the || is an operator that means or. You can do that for each name so in psuedo that line says.
If the string is "Sasuke_Uchiha" OR "" then.

This is a really inefficient way of doing things, but it is ONE way to how you have written it.


Re: help with strcmp - AroseKhanNiazi - 06.03.2014

Quote:
Originally Posted by BKarner
Посмотреть сообщение
if(!strcmp(name, "Sasuke_Uchiha", true) || !strcmp(name, "", true))
but see there is one less "(" bracket where i add before !strcmp ??
or will it work like that


Re: help with strcmp - BKarner - 06.03.2014

Quote:
Originally Posted by AroseKhanNaizi
Посмотреть сообщение
but see there is one less "(" bracket where i add before !strcmp ??
or will it work like that
It will work like that. If you add in another bracket it will assume there's another function to look for, which there isn't.


Re: help with strcmp - XK - 06.03.2014

Yes it will work