SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 22/09/2017, 04:17 PM   #1
Kampott
Little Clucker
 
Join Date: Sep 2017
Posts: 45
Reputation: 3
Default STRCMP bug?

so, this is basically my code
Code:
new name[25];
			GetPlayerName(playerid, name, 25);
			new house = pInfo[playerid][pIH];
			if(strcmp(hInfo[house][hOwner], name, true, sizeof(name)))		
			{
				print("?");
				ShowPlayerDialog(playerid, BHIM, DIALOG_STYLE_LIST, ""#COL_WHITE"House Owner Menu", "Close/Open house\nHouse Info\nUse Safe\nUse Freezer\nUse Store\nSee Last House Visitors List\nRespawn Car\nSell Car", "Select", "Close");
			}
			else
			{
				printf("%s %s",name,hInfo[house][hOwner]);
				return 1;
			}
At the end, it shows in console something like "Mynickname Mynickname", with no differences. What's the matter in here?
Kampott is offline   Reply With Quote
Old 22/09/2017, 04:20 PM   #2
ToiletDuck
Huge Clucker
 
ToiletDuck's Avatar
 
Join Date: Apr 2012
Location: Philippines, Lucena City
Posts: 400
Reputation: 43
Default Re: STRCMP bug?

Code:
if(strcmp(hInfo[house][hOwner], name, true) == 0)		
			{
				print("?");
				ShowPlayerDialog(playerid, BHIM, DIALOG_STYLE_LIST, ""#COL_WHITE"House Owner Menu", "Close/Open house\nHouse Info\nUse Safe\nUse Freezer\nUse Store\nSee Last House Visitors List\nRespawn Car\nSell Car", "Select", "Close");
			}
			else
			{
				printf("%s %s",name,hInfo[house][hOwner]);
				return 1;
			}
ToiletDuck is offline   Reply With Quote
Old 22/09/2017, 04:20 PM   #3
SlowARG
Little Clucker
 
Join Date: Feb 2014
Posts: 38
Reputation: 18
Default Re: STRCMP bug?

If strcmp match, returns 0.
So your code must be if(strcmp(..) == 0)

Regards.
__________________
My releases:

[GitLab] [Plugin] Nobody's fork of YSF
[GitLab] [FilterScript] SA-MP S.S.F.P.
SlowARG is offline   Reply With Quote
Old 22/09/2017, 04:26 PM   #4
Kampott
Little Clucker
 
Join Date: Sep 2017
Posts: 45
Reputation: 3
Default Re: STRCMP bug?

Thanks for the two people above.
Kampott 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
Strcmp Lirbo Scripting Help 7 22/07/2015 03:02 AM
[Ajuda] if (strcmp(tmp SukMathcuck Português/Portuguese 2 07/07/2015 09:40 PM
Strcmp help (_AcE_) Scripting Help 4 04/03/2014 10:00 AM
can some these things into CMD not strcmp because its already strcmp.with sscanf+zcmd. mittukuttan Scripting Help 5 21/02/2013 10:52 AM
The Difference Between !strcmp & strcmp Dennis_Smith Scripting Help 4 17/11/2012 02:21 AM


All times are GMT. The time now is 08:19 AM.


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