/me command
#1

Someone give me the code or teach me how to make a basic /me command that goes with the Chat Radius
Reply
#2

okey, lets take zcmd as example

First the command header
pawn Code:
CMD:me(playerid, text[]) {
    return true;
}
than the first we check inside is if the text is empty

pawn Code:
if(isnull(text) {
    SendClientMessage(playerid, -1, "Usage: /me [text]");
    return true;
}
if the text isnt empty

we get at first the position of the player which is necessary for our range check
pawn Code:
new
    Float: X,
    Float: Y,
    Float: Z;
GetPlayerPos(playerid, X, Y, Z);
in the end we loop through all players and use IsPlayerInRangeOfPoint
if he is we send him the message

pawn Code:
for(new i; i != MAX_PLAYERS; ++i) {
    if(IsPlayerInRangeOfPoint(i, 30.0, X, Y, Z)) {
        SendPlayerMessageToPlayer(i, playerid, text);
    }
}
Reply
#3

well my friend u came Lucky i got the script
pawn Code:
if(!strcmp(cmdtext, "/me", true, 3))
        {
            if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [text]");
            new str[128];
            GetPlayerName(playerid, str, sizeof(str));
            format(str, sizeof(str), "%s %s", str, cmdtext[4]);
            SendClientMessageToAll(COLOR_YELLOW, str);
            return 1;
        }
Reply
#4

C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(103) : error 017: undefined symbol "me"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(106) : warning 225: unreachable code
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(106) : error 017: undefined symbol "isnull"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(117) : error 017: undefined symbol "text"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(103) : warning 203: symbol is never used: "CMD"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Help
Reply
#5

You must have the zcmd include
pawn Code:
COMMAND:me(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /me [text]");
    {
        new string[128], name[24];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s: %s", name, params);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
    }
    return 1;
}
Reply
#6

Can I get a link to it
Reply
#7

Sure, Click me
Reply
#8

Quote:
Originally Posted by CyberGhost
View Post
You must have the zcmd include
pawn Code:
COMMAND:me(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /me [text]");
    {
        new string[128], name[24];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s: %s", name, params);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
    }
    return 1;
}
.....??


PHP Code:
stock SendLocalChat(playerid,color,msg[],Float:radius)
{
  new 
Float:x,Float:y,Float:z;
  
GetPlayerPos(playerid,x,y,z);
  for(new 
ply;ply<MAX_PLAYERS;ply++)
  {
    if(
IsPlayerInRangeOfPoint(ply,radius,x,y,z))SendClientMessage(ply,color,msg);
  }
  return 
1;

PHP Code:
CMD:me(playeridparams[])
{
    if(
sscanf(params"s[128]"params)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /me [text]");
    new 
str[128], new PlayerName[24];
     
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
      
format(strsizeof(str), "* %s %s"PlayerNameparams);
       
SendLocalChat(playerid,COLOR_PURPLE,str,30.0);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)