[Help] OnPlayerText with Text
#1

i was making Some password in file that if she Writes in Game something happenes
For Example:
in file blabla.ini : 5555
That number i want to use in mode so
i'm reading the number in file and making
some new
New NumberX;
than i'm making this NumberX get the value 5555
so If Password Changes in File
Password changes in game
Код:
public LoadPassword()
{
	new strFromFile[256];
	new File: Bla = fopen("blabla.cfg", io_read);
	if (Bla)
	{
		fread(Bla, strFromFile);
		NumberX= strval(strFromFile);
		fclose(Bla);
	}
	return 1;
}
Ok now it means
NumberX(Value) = 5555 right?
But now
i want to make that if someone Write the "NumberX" Value without "/" just
"NumberX" Value
it send him message
So i made it
Код:
public OnPlayerText(playerid, text[])
{
	new tmp[256];
	new string[256];
	new idx;
	tmp = strtok(text, idx);
	 if ((strcmp(NumberX, tmp, true, strlen(tmp)) == 0)))
	 {
	  SendClientMessage(playerid, COLOR_GREY, "NumberX Value");
	  return 0;
    }
    else
    {
      SendClientMessage(playerid, COLOR_GREY, "Not NumberX Value");
      return 0;
    }
    return 1;
}
So when someone writes the NumberX Value it send him message "NumberX Value"
But it dont work and gives me a warning of the line with
if ((strcmp(NumberX, tmp, true, strlen(tmp)) == 0)))
the Warning is: error 035: argument type mismatch (argument 2)
Someone Can help me?
Reply
#2

try this->
Код:
if ((strcmp(NumberX, tmp, true, strlen(tmp)) == 0)
Bearfist
Reply
#3

+1 to previous comment, you closed more brackets than you had open. Also, this means every time anyone says anything they'll get a message telling them that what they typed isn't 5555? Plus I don't see how the file comes into this, there are no file functions..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)