03.03.2009, 05:12
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]~~
~~[Drift]~~
#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;
}
// 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;
}
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);
}
PlayerName(playerid)
{
new n[24];
GetPlayerName(playerid,n,24);
return n;
}
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
}