SA-MP Forums Archive
If someone says "hey" a message is sent to the player - 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: If someone says "hey" a message is sent to the player (/showthread.php?tid=125998)



If someone says "hey" a message is sent to the player - braduz - 06.02.2010

Need help on doing this ^^


Re: If someone says "hey" a message is sent to the player - Rzzr - 06.02.2010

More information please..


Re: If someone says "hey" a message is sent to the player - pspleo - 06.02.2010

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(!strcmp(text, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}



Re: If someone says "hey" a message is sent to the player - braduz - 06.02.2010

Quote:
Originally Posted by PSPLeo
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(!strcmp(text, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
tanks


Re: If someone says "hey" a message is sent to the player - braduz - 06.02.2010

Quote:
Originally Posted by PSPLeo
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(!strcmp(text, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
error 017: undefined symbol "text"


Re: If someone says "hey" a message is sent to the player - Rzzr - 06.02.2010

What line is the error on?


Re: If someone says "hey" a message is sent to the player - MaykoX - 06.02.2010

Quote:
Originally Posted by braduz
Quote:
Originally Posted by PSPLeo
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(!strcmp(text, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
error 017: undefined symbol "text"
Just change "text to what you have at OnPlayerText(player, "that is that TEXT error" so you will have

public OnPlayerText(playerid, //IDK WHAT YOU GOT HERE[])
{
if(!strcmp(//SAME AS IDK..., "hey", true))
{
SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
}
}


Re: If someone says "hey" a message is sent to the player - braduz - 06.02.2010

Quote:
Originally Posted by MaykoX
Quote:
Originally Posted by braduz
Quote:
Originally Posted by PSPLeo
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(!strcmp(text, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
error 017: undefined symbol "text"
Just change "text to what you have at OnPlayerText(player, "that is that TEXT error" so you will have

public OnPlayerText(playerid, //IDK WHAT YOU GOT HERE[])
{
if(!strcmp(//SAME AS IDK..., "hey", true))
{
SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
}
}



Re: If someone says "hey" a message is sent to the player - DeathOnaStick - 06.02.2010

I explain what he means:

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(!strcmp(text, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
You need to have the variable "text" in the public declaration. That means, if "text[]" would be "Woot[]" it would look like this:

pawn Код:
public OnPlayerText(playerid, Woot[])
{
  if(!strcmp(Woot, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
The name of the string in the comparation must the the same as in the public declaration.

I hope you understood.


Re: If someone says "hey" a message is sent to the player - braduz - 06.02.2010

Quote:
Originally Posted by DeathOnaStick
I explain what he means:

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(!strcmp(text, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
You need to have the variable "text" in the public declaration. That means, if "text[]" would be "Woot[]" it would look like this:

pawn Код:
public OnPlayerText(playerid, Woot[])
{
  if(!strcmp(Woot, "hey", true))
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "Message here");
  }
}
The name of the string in the comparation must the the same as in the public declaration.

I hope you understood.
ahh, so if i added lots of texts i would have to add them all in the title brackets? ()