how to script /me?
#1

Im starting my own server, and i looked on *******, but i couldnt find how to make /me, can anyone help me??
Reply
#2

pawn Код:
if(!strcmp("/me", cmdtext, true))
{
  new str[218],name[24]; // creating variables: str and name for the text-string and the name of the player
  GetPlayerName(playerid, name, 24); // getting the playername and storing it in the variable name
  format(str, 218, "%s: %s", name, cmdtext[3]); // formatting the string with the name and the message behind the command /me
  SendClientMessageToAll(0xFF0000AA, str); // sending the text
  return 1;
}
Needs perfectioning but it is standard without checking for empty stuff..
Reply
#3

Thx
Reply
#4

i need a new /me code, that one dosent work, it wont show the messege
Reply
#5

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(me, 2, cmdtext);
  return 0;
}

dcmd_me(playerid, params)
{
  new name[24], str[128];
  if(!strlen(params)) return SendClientMessage(playerid, color, "Usage: /me [action]");
  GetPlayerName(playeird, name, sizeof name);
  format(str, sizeof str, "**%s %s", name, str);
  SendClientMessageToAll(color, str);
  return 1;
}
Reply
#6

Quote:
Originally Posted by Swift_
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(me, 2, cmdtext);
  return 0;
}

dcmd_me(playerid, params)
{
  new name[24], str[128];
  if(!strlen(params)) return SendClientMessage(playerid, color, "Usage: /me [action]");
  GetPlayerName(playeird, name, sizeof name);
  format(str, sizeof str, "**%s %s", name, str);
  SendClientMessageToAll(color, str);
  return 1;
}
I don't think that'll going to work..
First off, it should look more like this:
pawn Код:
dcmd_me(playerid, params[])
{
  new name[24], str[128];
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_, "Usage: /me [action]");
  GetPlayerName(playerid, name, sizeof name);
  format(str, sizeof str, "**%s %s", name, str);
  SendClientMessageToAll(COLOR_, str);
  return 1;
}

But it'll just print the following to the text box:
Quote:

**Username

Reply
#7

Mine would work, all he'd have to do is change
Код:
dcmd_me(playerid, params)
to
Код:
dcmd_me(playerid, params[])
and change the words "color" to his desired color.
Reply
#8

You have a simple /me command at SA:MP Wiki:
https://sampwiki.blast.hk/wiki/Using_strcmp()
Reply
#9

Quote:
Originally Posted by Swift_
Mine would work, all he'd have to do is change
Код:
dcmd_me(playerid, params)
to
Код:
dcmd_me(playerid, params[])
and change the words "color" to his desired color.
Well, I corrected the errors, and it doesn't work.
Let's say my user name is Andreas.
When I do '/me jumps' it'll just show '**Andreas', and not the "jump" text.
Reply
#10

Small typo
pawn Код:
format(str, sizeof str, "%s %s", name, params);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)