i need the /me comand lol
#1

ok this is a really stupid question, but so simple i cant find it on the internet, i dont have the /me command lol, can someone send it to me please? Thankyou!

~~[Drift]~~
Reply
#2

There you go:

pawn Код:
#include <a_samp>

#define SOME_COLOR 0x
#define SOME_COLOR2 0x
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

dcmd_me(playerid, params[])
{
    #pragma unused params

    if(!strlen(params))
      return SendClientMessage(playerid, SOME_COLOR, "[USAGE]: /me ACTION");

    new name[24], string[128];

    GetPlayerName(playerid, name, 24);
    format(string, 128, "* %s %s", name, params);
    return SendClientMessageToAll(SOME_COLOR2, string);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(me, 2, cmdtext);
    return 0;
}
Replace the colors with your needs.
I use red and dodger Blue.

Red for the usage text.
Dodger blue for the action.

Get a lot of colors from here http://www.free-webmaster-tools.com/colorpicker.htm
Reply
#3

pawn Код:
// Bigstrtok function.
stock bigstrtok(const string[], &idx)
{
  new length = strlen(string);
    while ((idx < length) && (string[idx] <= ' '))
    {
        idx++;
    }
    new offset = idx;
    new result[128];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
        result[idx - offset] = string[idx];
        idx++;
    }
    result[idx - offset] = EOS;
    return result;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new string[128],bigtext[128];
  if(!strcmp(cmd,"/me",true))
  {
     bigtext=bigstrtok(cmdtext,idx);
     if(!strlen(bigtext)) return SendClientMessage(playerid,0xAFAFAFAA,"Syntax: /me [action]");
     format(string,sizeof(string)," * %s  %s.",PlayerName(playerid),bigtext);
     retirm SendClientMessageToAll(0xAA3333AA,string);
  }
Use that as the PlayerName varaieble.
pawn Код:
PlayerName(playerid)
{
  new n[24];
  GetPlayerName(playerid,n,24);
  return n;
}
Reply
#4

i think you ment:
return at retirm SendClientMessageToAll(0xAA3333AA,string);
Reply
#5

pawn Код:
if(!strcmp("/me", cmdtext, true, 3))
{
    if(cmdtext[3] != 32 || cmdtext[4] == EOS)
        return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /me [text]");
    new string[128];
    GetPlayerName(playerid, string, MAX_PLAYER_NAME);
    format(string, sizeof string, "%s %s", string, cmdtext[4]);
    return SendClientMessageToAll(GetPlayerColor(playerid), string);
    //the text will be black if the playercolor wasnt set
}
Reply
#6

alright thanks a lot guys! lolz, i know it didnt take much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)