SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 03/08/2010, 09:44 AM   #1
Maxips2
Huge Clucker
 
Join Date: Oct 2008
Posts: 410
Reputation: 20
Default [Help] Comparing strings (strcmp)

I did it like that:
pawn Code:
if(!strcmp(inputtext, gServerPassword))
                {
                    SCM(playerid, COLOR_LIGHTRED, "Wrong password!");
                    Kick(playerid);
                    return 1;
                }

But I'm getting this error:
pawn Code:
error 035: argument type mismatch (argument 2)
Any ideas?
Maxips2 is offline  
Old 03/08/2010, 10:19 AM   #2
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,421
Reputation: 271
Default Re: [Help] Comparing strings (strcmp)

maybe something to do with "gServerPassword" is it an array, does it hold a string? Also it looks like your comparing two passwords and if they are the same kicking them lol.
I think you want,
pawn Code:
if(strcmp(inputtext, gServerPassword))

Last edited by iggy1; 03/08/2010 at 07:37 PM. Reason: typos
iggy1 is offline  
Old 03/08/2010, 10:46 AM   #3
Zimon95
Big Clucker
 
Zimon95's Avatar
 
Join Date: Sep 2009
Location: Ravenna, Italy
Posts: 182
Reputation: 10
Default Re: [Help] Comparing strings (strcmp)

Try this, it should work, by the way you have to assign a string to that variable:
pawn Code:
if(strcmp(inputtext,gServerPassword,false))
                {
                    SCM(playerid, COLOR_LIGHTRED, "Wrong password!");
                    Kick(playerid);
                    return 1;
                }
Zimon95 is offline  
 

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: Switch() and If() DeathOnaStick Help Archive 5 16/07/2010 07:39 PM
Use strcmp to compare 2 strings TimBuk.Ekh Help Archive 7 21/06/2010 10:34 PM
comparing ips ?? BLAbla93 Help Archive 0 23/05/2010 04:55 AM
Name Comparing stock IamNotKoolllll Help Archive 3 24/04/2010 10:30 PM
[help] string comparing borisblat Help Archive 3 22/09/2009 09:30 PM


All times are GMT. The time now is 09:39 AM.


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