Problem with cmd
#1

Hello guys, I want to create a script that when a player type "lol" is applied to the animation and get an action.
I put this in OnPlayerText but it not work.

pawn Код:
new sendername[MAX_PLAYER_NAME];
    if (strcmp("lol", tmp, true) == 0)
    {
          format(string, sizeof(string), "* %s ride con gusto", sendername);
          ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0, 1);
          return 1;
    }
I try to put in OnPlayerCommandText with this code:
pawn Код:
if (strcmp("lol", cmdtext, true) == 0)
    {
          format(string, sizeof(string), "* %s ride con gusto", sendername);
          ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0, 1);
          return 1;
    }
is compiled successfully, but does not work in any case

Sorry for my bad english з_з
Reply
#2

up......
Reply
#3

OnPlayerCommandText is called when you start the text with '/'. If you want it to work add a '/' infront of the "lol". If you want it to happen to people who type it in the chat use OnPlayerText
Reply
#4

pawn Код:
public OnPlayerText;
{
      new sendername[MAX_PLAYER_NAME];
      new idx;
      tmp = strtok(text, idx);
      if (strcmp("lol", tmp, true) == 0)
      {
            format(string, sizeof(string, "* %s ride con gusto", sendername);
            ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0, 1);
            return 1;
      }
      return 0;
}
// I hope you have string set.. new string[ 128 ];
// + If you edditing some mod, than you will have strtok, if not, say me..
// Not tested, but should work..
Reply
#5

Quote:
Originally Posted by Mikkel_Pedersen
Посмотреть сообщение
OnPlayerCommandText is called when you start the text with '/'. If you want it to work add a '/' infront of the "lol". If you want it to happen to people who type it in the chat use OnPlayerText
I try tu put in OnPlayerText but it not work. When I type "lol" appares lol in chat, but not appares the anim or the actions
Quote:
Originally Posted by MartinDee
Посмотреть сообщение
pawn Код:
public OnPlayerText;
{
      new sendername[MAX_PLAYER_NAME];
      new idx;
      tmp = strtok(text, idx);
      if (strcmp("lol", tmp, true) == 0)
      {
            format(string, sizeof(string, "* %s ride con gusto", sendername);
            ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0, 1);
            return 1;
      }
      return 0;
}
// I hope you have string set.. new string[ 128 ];
// + If you edditing some mod, than you will have strtok, if not, say me..
// Not tested, but should work..
Ok im going to test.
Reply
#6

Quote:
Originally Posted by MartinDee
Посмотреть сообщение
pawn Код:
public OnPlayerText;
{
      new sendername[MAX_PLAYER_NAME];
      new idx;
      tmp = strtok(text, idx);
      if (strcmp("lol", tmp, true) == 0)
      {
            format(string, sizeof(string, "* %s ride con gusto", sendername);
            ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0, 1);
            return 1;
      }
      return 0;
}
// I hope you have string set.. new string[ 128 ];
// + If you edditing some mod, than you will have strtok, if not, say me..
// Not tested, but should work..
Why the hell do you use strtok?

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(!strcmp(text, "lol", true))
    {
        new sendername[24], string[40];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0, 1);
        format(string, sizeof(string, "* %s ride con gusto", sendername);
        return SendClientMessageToAll(0xFFFFFFFF, string);
    }
    return 1;
}
Reply
#7

You need to put /lol for the cmd to work.Making it lol only would not work.
Reply
#8

If you were talking to me, stop saying things you don't know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)