SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 20/01/2016, 08:18 AM   #1
Black Axe
Huge Clucker
 
Black Axe's Avatar
 
Join Date: Nov 2011
Location: California
Posts: 207
Reputation: 37
Default Comparing 2 strings using strcmp.

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.

Code:
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!
__________________
Black Axe is offline   Reply With Quote
Old 20/01/2016, 08:24 AM   #2
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,769
Reputation: 754
Default Re: Comparing 2 strings using strcmp.

pawn Code:
if(!strcmp(HouseInfo[i][HOwner], PlayerName(playerid), false))
SickAttack is offline   Reply With Quote
Old 20/01/2016, 08:26 AM   #3
Black Axe
Huge Clucker
 
Black Axe's Avatar
 
Join Date: Nov 2011
Location: California
Posts: 207
Reputation: 37
Default Re: Comparing 2 strings using strcmp.

Quote:
Originally Posted by SickAttack View Post
pawn Code:
if(!strcmp(HouseInfo[i][HOwner], PlayerName(playerid), false))
Oh wow that's alot easier than I thought, thanks bud.
__________________
Black Axe is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing 2 strings Aa12 Scripting Help 8 08/01/2016 06:20 PM
comparing strings HondaCBR Scripting Help 2 02/01/2012 03:15 PM
Comparing strings error HondaCBR Scripting Help 6 21/11/2011 05:19 PM
Help with comparing two strings OUL Scripting Help 2 02/11/2011 06:11 PM
[Help] Comparing strings (strcmp) Maxips2 Help Archive 2 03/08/2010 10:46 AM


All times are GMT. The time now is 04:45 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.