11.04.2012, 00:18
You are using strfind incorrectly. You have to see if strfind returns -1 for it to be true. You should use strcmp instead.
Example
Another flaw in your code is the variable
You need to make sure that that variable is a string in your Player Data enumerator.
I use this stock to replace a string.
This is how it is used
Example
pawn Код:
if(!strcmp(inputtext,"America",true))
{
SendClientMessage(playerid, -1, "You typed America in the dialog box!");
return 1;
}
pawn Код:
pData[playerid][pSex]
I use this stock to replace a string.
pawn Код:
stock strreplace(string[], find, replace)
{
for(new i=0; string[i]; i++) {
if(string[i] == find) {
string[i] = replace;
}
}
}
pawn Код:
if(!strcmp(inputtext,"Male",true))
{
SendClientMessage(playerid, -1, "So you are a Male!");
strreplace(pData[playerid][pSex],pData[playerid][pSex],inputtext);
// The first parameter gets the string
// The second parameter basically selects the whole string
// The last parameter replaces the whole string with the dialog inputtext.
return 1;
}