SA-MP Forums Archive
/me command? - 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 command? (/showthread.php?tid=122351)



/me command? - stieben - 21.01.2010

Does anyone how to make a simple /me command?

Thank to everyone who helps me.


Re: /me command? - [03]Garsino - 21.01.2010

Top of script...
pawn Код:
#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
Inside OnPlayerCommandText...
pawn Код:
dcmd(me, 2, cmdtext);
Bottom of Script...
pawn Код:
dcmd_me(playerid,params[])
{

    new string[128];
    if(!strlen(params)) return SendClientMessage(playerid,0xF60000AA, "/me <action>.");
    format(string, sizeof(string), "* %s (%d) %s", pNick(playerid), playerid, params);
    SendClientMessageToAll(0x00FFFFFF, string);
    return 1;
}
pawn Код:
stock pNick(playerid)
{
    new nick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
    return nick;
}



Re: /me command? - stieben - 21.01.2010

I get 1 error:
Код:
error 036: empty statement
Which is this line:
Код:
dcmd(me, 2, cmdtext);



Re: /me command? - [03]Garsino - 21.01.2010

Quote:
Originally Posted by stieben
I get 1 error:
Код:
error 036: empty statement
Which is this line:
Код:
dcmd(me, 2, cmdtext);
Show me where you placed it in the script.


Re: /me command? - stieben - 21.01.2010

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



Re: /me command? - [03]Garsino - 21.01.2010

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



Re: /me command? - stieben - 21.01.2010

Does not work


Re: /me command? - [03]Garsino - 21.01.2010

pawn Код:
#include <a_samp>
#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
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(me, 2, cmdtext);
    return 0;
}
pawn Код:
dcmd_me(playerid,params[])
{

    new string[128];
    if(!strlen(params)) return SendClientMessage(playerid,0xF60000AA, "/me <action>.");
    format(string, sizeof(string), "* %s (%d) %s", pNick(playerid), playerid, params);
    SendClientMessageToAll(0x00FFFFFF, string);
    return 1;
}

stock pNick(playerid)
{
    new nick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
    return nick;
}
Works for me..


Re: /me command? - thiaZ_ - 21.01.2010

yeah, that should work.


Re: /me command? - SlashPT - 21.01.2010

or ZCMD

download ZCMD Include

on top of script
pawn Код:
#include <zcmd>
on end of script
pawn Код:
command(me,playerid,params[])
{
new string[128];
if(!strlen(params)) return SendClientMessage(playerid,0xF60000AA, "/me <action>.");
format(string, sizeof(string), "* %s (%d) %s", pNick(playerid), playerid, params);
SendClientMessageToAll(0x00FFFFFF, string);
return 1;
}

stock pNick(playerid)
{
new nick[MAX_PLAYER_NAME];
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
return nick;
}