Raised This Month: $ Target: $400
 0% 

[SOLVED]If Statements with Strings?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gameguysz
Member
Join Date: Aug 2011
Location: USA
Old 11-23-2011 , 02:30   [SOLVED]If Statements with Strings?
Reply With Quote #1

I basically want to do something like this

if(a == 1 && String == "Aword")
{
//Then do this
}


Any help you guys :]

Last edited by gameguysz; 11-25-2011 at 00:28.
gameguysz is offline
necavi
Veteran Member
Join Date: Sep 2010
Old 11-23-2011 , 02:48   Re: [HELP]If Statements with Strings?
Reply With Quote #2

Code:
if(a == 1 && StrEqual(String,"Aword"))
{
    //Then do this
}

Last edited by necavi; 11-23-2011 at 02:48.
necavi is offline
gameguysz
Member
Join Date: Aug 2011
Location: USA
Old 11-23-2011 , 02:55   Re: [HELP]If Statements with Strings?
Reply With Quote #3

Im getting mismatch error...

Quote:
if(a >= 1.0 && StrEqual(Type,"calc", 0))
im trying to get what the player says do when he goes lets say !command calc it will store calc into a String and then i can compare it for a if statement

Last edited by gameguysz; 11-23-2011 at 02:59.
gameguysz is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 11-23-2011 , 04:57   Re: [HELP]If Statements with Strings?
Reply With Quote #4

Change that 0 to false.
__________________

Last edited by McFlurry; 11-23-2011 at 04:57.
McFlurry is offline
Send a message via Skype™ to McFlurry
gameguysz
Member
Join Date: Aug 2011
Location: USA
Old 11-23-2011 , 05:59   Re: [HELP]If Statements with Strings?
Reply With Quote #5

Quote:
Originally Posted by McFlurry View Post
Change that 0 to false.

It works but i cant seem to retrieve the string using something like this..

new String:astring[5] = GetCmdArg(3, astring, sizeof(astring));


im sure its something stupid that im messing up with, im relatively new with strings so sorry for all the questions :/
gameguysz is offline
Scone
Senior Member
Join Date: Apr 2010
Location: England
Old 11-23-2011 , 06:34   Re: [HELP]If Statements with Strings?
Reply With Quote #6

PHP Code:
decl String:astring[5];
GetCmdArg(3astringsizeof(astring)); 
No need for the equals there.
__________________
Scone is offline
gameguysz
Member
Join Date: Aug 2011
Location: USA
Old 11-23-2011 , 06:46   Re: [HELP]If Statements with Strings?
Reply With Quote #7

Thank you :] It works!

Last edited by gameguysz; 11-23-2011 at 07:07.
gameguysz is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 11:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode