SA-MP Forums Archive
[Help] OnPlayerText with Text - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] OnPlayerText with Text (/showthread.php?tid=52648)



[Help] OnPlayerText with Text - PoWerZ - 07.10.2008

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?


Re: [Help] OnPlayerText with Text - Bearfist - 08.05.2009

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


Re: [Help] OnPlayerText with Text - Weirdosport - 08.05.2009

+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..