25.01.2013, 07:43
i need /me command with sscanf and zcmd
CMD:me(playerid, params[])
{
new Message[128], sendername[MAX_PLAYER_NAME];
new actiontext[MAX_CHATBUBBLE_LENGTH+1];
new metext[MAX_CHATBUBBLE_LENGTH+1];
if(sscanf(params,"s", Message)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /me [text]");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s", Message);
format(metext,MAX_CHATBUBBLE_LENGTH,"* %s %s", sendername, Message);
SetPlayerChatBubble(playerid,actiontext,0xFF9900FF,30.0,10000);
SendClientMessageToAll(0xFFFFFFFF,metext);
return 1;
}
pawn Код:
EDIT: Also post it in Here . Not on this one |
CMD:me(playerid, params[])
{
new text[100], str[128], pName[MAX_PLAYER_NAME], Float: Pos[3];
if(sscanf(params,"s[100]", text))
return SendClientMessage(playerid, -1,"USAGE: /me [action]");
GetPlayerName(playerid, pName, sizeof pName);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(str, sizeof str, "%s %s", pName, text);
for(new i = 0; i<MAX_PLAYERS; i++)
if(IsPlayerInRangeOfPoint(i, 30.0, Pos[0], Pos[1], Pos[2]))
SendClientMessage(i, -1, str);
return 1;
}
COMMAND:me(playerid,params[])
{
new Msg[128], Message[128], Name[24];
if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"* Private200 <action>\"");
else
{
GetPlayerName(playerid, Name, sizeof(Name));
format(Msg, sizeof(Msg), "* %s: %s", Name, Message);
SendClientMessageToAll(0xFFFF00AA, Msg);
}
return 1;
}
pawn Код:
|
#include <sscanf2> #include <ZCMD>
COMMAND:me(playerid,params[]) { new msg[50]; if(!sscanf(params, "s[50]",msg)) { new mename[MAX_PLAYER_NAME]; GetPlayerName(playerid,mename,sizeof(mename)); new string[256]; format(string,sizeof(string),"** %s %s **",mename,msg); SendClientMessageToAll(COLOR_PINK,string); } else SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /me <rp text>"); return 1; }