SA-MP Forums Archive
Comparing 2 strings using 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: Comparing 2 strings using strcmp. (/showthread.php?tid=599044)



Comparing 2 strings using strcmp. - Black Axe - 20.01.2016

Hello!

So I've been working on my house system and I am at my final touches. Basically my system works through names, it saves the names to the house and that's how it recognizes if its the owner or not. I am trying to make a lock house command but the problem is that I am not sure how to compare both strings, I've already tried several tutorials and wiki but none of them really help.

Код:
if(HouseInfo[i][HOwner] == !strcmp(HouseInfo[i][HOwner], PlayerName(playerid), false))
The HOwner variable is already a string with the owner's name stored in it. But I just can't figure out how to compare it to the player's name who's performing the command. [obviously starting from !strcmp is wrong].

Could anyone show me the correct formula please? Plus some explanation would be greatly appreciated.

Thanks!


Re: Comparing 2 strings using strcmp. - SickAttack - 20.01.2016

pawn Код:
if(!strcmp(HouseInfo[i][HOwner], PlayerName(playerid), false))



Re: Comparing 2 strings using strcmp. - Black Axe - 20.01.2016

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
pawn Код:
if(!strcmp(HouseInfo[i][HOwner], PlayerName(playerid), false))
Oh wow that's alot easier than I thought, thanks bud.