SA-MP Forums Archive
"/me" bugged - 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: "/me" bugged (/showthread.php?tid=133719)



"/me" bugged - Chriham3 - 13.03.2010

Hello!
This is my /me.

pawn Код:
if(strcmp(cmdtext, "/me", true) == 0)
    {
        new string[256], sendername[MAX_PLAYER_NAME];
        new idx;
      if(IsPlayerConnected(playerid))
      {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [action]");
                return 1;
            }
                format(string, sizeof(string), "* %s %s", sendername, result);
            }
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            printf("%s", string);
            return 1;
    }
For some reasons, it is bugged and dont work.

if I type "/me"
It returns:
*** Christian_Hammer /me ***

if I type i.e "/me takes out a gun from his bag"
It returns nothing.

Help!
What is wrong?


Re: "/me" bugged - Naxix - 13.03.2010

Why not just use:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    SendClientMessageToAll(0xFFFF00AA, str);
    return 1;
  }
  return 0;
}
from https://sampwiki.blast.hk/wiki/Using_strcmp%28%29??


Re: "/me" bugged - Chriham3 - 13.03.2010

Quote:
Originally Posted by Naxix
Why not just use:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    SendClientMessageToAll(0xFFFF00AA, str);
    return 1;
  }
  return 0;
}
from https://sampwiki.blast.hk/wiki/Using_strcmp%28%29??
Ok, but why is it strcmp packed?
pawn Код:
!strcmp



Re: "/me" bugged - Naxix - 13.03.2010

Hmm.. I'm not sure, but it should work :b


Re: "/me" bugged - MenaceX^ - 13.03.2010

It will not send the message to players in the distance you want.


Re: "/me" bugged - Chriham3 - 13.03.2010

Quote:
Originally Posted by Naxix
Why not just use:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    SendClientMessageToAll(0xFFFF00AA, str);
    return 1;
  }
  return 0;
}
from https://sampwiki.blast.hk/wiki/Using_strcmp%28%29??
Thanks!