how to script /me? - 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: how to script /me? (
/showthread.php?tid=85932)
how to script /me? -
Badandy - 10.07.2009
Im starting my own server, and i looked on *******, but i couldnt find how to make /me, can anyone help me??
Re: how to script /me? -
mamorunl - 10.07.2009
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..
Re: how to script /me? -
Badandy - 10.07.2009
Thx
Re: how to script /me? -
Badandy - 10.07.2009
i need a new /me code, that one dosent work, it wont show the messege
Re: how to script /me? -
Grim_ - 10.07.2009
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;
}
Re: how to script /me? -
Anarkien - 10.07.2009
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:
Re: how to script /me? -
Grim_ - 10.07.2009
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.
Re: how to script /me? -
Correlli - 10.07.2009
You have a simple /me command at SA:MP Wiki:
https://sampwiki.blast.hk/wiki/Using_strcmp()
Re: how to script /me? -
Anarkien - 10.07.2009
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.
Re: how to script /me? -
Grim_ - 10.07.2009
Small typo
pawn Код:
format(str, sizeof str, "%s %s", name, params);