How do I check if a string Equals a certain word?
#4

I looked through Wiki and found strcmp, I'm about to test it to see if its correct for what I'm wanting..
Код:
COMMAND:gender(playerid,params[])
{
	if(!strcmp(params, "female", true, 6) || !strcmp(params, "male", true, 4))
	{
		SetPVarString(playerid,"Gender",params);
		new strz[38];
		format(strz,sizeof(strz), "Your gender is now set to: %s.",params);
		SendClientMessage(playerid, blue, strz);
	} else {
        SendClientMessage(playerid, blue, "INVALID GENDER, Male or Female.");
	}
	return 1;
}
Correct or Incorrect..

Edit: Oops sorry..

Edit (2):
Ok, that kind of works, but i can do /gender femaleanything /gender maleanything
Reply


Messages In This Thread
How do I check if a string Equals a certain word? - by ViperSniper - 19.01.2011, 17:09
Re: How do I check if a string Equals a certain word? - by Macluawn - 19.01.2011, 17:21
Re: How do I check if a string Equals a certain word? - by ViperSniper - 19.01.2011, 17:28
Re: How do I check if a string Equals a certain word? - by ViperSniper - 19.01.2011, 17:30
Re: How do I check if a string Equals a certain word? - by WillyP - 19.01.2011, 17:31
Re: How do I check if a string Equals a certain word? - by ViperSniper - 19.01.2011, 17:35

Forum Jump:


Users browsing this thread: 1 Guest(s)