Help Need Help
#9

You are using strfind incorrectly. You have to see if strfind returns -1 for it to be true. You should use strcmp instead.

Example

pawn Код:
if(!strcmp(inputtext,"America",true))
{
    SendClientMessage(playerid, -1, "You typed America in the dialog box!");
    return 1;
}
Another flaw in your code is the variable
pawn Код:
pData[playerid][pSex]
You need to make sure that that variable is a string in your Player Data enumerator.
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;
        }
    }
}
This is how it is used
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;
}
Reply


Messages In This Thread
Help Need Help - by RicaNiel - 10.04.2012, 23:38
Re: Help Need Help - by ReneG - 10.04.2012, 23:44
Re: Help Need Help - by RicaNiel - 10.04.2012, 23:46
Re: Help Need Help - by ViniBorn - 10.04.2012, 23:57
Re: Help Need Help - by ReneG - 11.04.2012, 00:00
Re: Help Need Help - by RicaNiel - 11.04.2012, 00:03
Re: Help Need Help - by ReneG - 11.04.2012, 00:05
Re: Help Need Help - by RicaNiel - 11.04.2012, 00:06
Re: Help Need Help - by ReneG - 11.04.2012, 00:18
Re: Help Need Help - by RicaNiel - 11.04.2012, 00:33

Forum Jump:


Users browsing this thread: 3 Guest(s)