SA-MP Forums Archive
Comparing string using strcmp help pls - 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: Comparing string using strcmp help pls (/showthread.php?tid=486110)



Comparing string using strcmp help pls - Riwerry - 07.01.2014

Guys I need to compare the string from INI.. I tried this but didnt work I want to comper if string in ini have value 0

pawn Код:
if (strcmp(Characters[playerid][Character1],"0") == 0)



Re: Comparing string using strcmp help pls - Sinner - 07.01.2014

pawn Код:
if(strval(Characters[playerid][Character1]) == 0) {
    // It's 0
} else {
    // It's not 0
}



Re: Comparing string using strcmp help pls - Riwerry - 07.01.2014

Thx, gonna to try it!


Re: Comparing string using strcmp help pls - Riwerry - 07.01.2014

Thx mate it works, and can I ask you for example when I have string with no value (like numbers like this one) but I have some text, which function i should use here??


Re: Comparing string using strcmp help pls - Sinner - 07.01.2014

Quote:
Originally Posted by Riwerry
Посмотреть сообщение
Thx mate it works, and can I ask you for example when I have string with no value (like numbers like this one) but I have some text, which function i should use here??
Then you should use strcmp, but I don't see why you would want to compare hardcoded strings.