/me command -
Rabbayazza - 10.08.2011
Someone give me the code or teach me how to make a basic /me command that goes with the Chat Radius
AW: /me command -
Nero_3D - 10.08.2011
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);
}
}
Re: /me command -
Zonoya - 10.08.2011
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;
}
Re: /me command -
Rabbayazza - 11.08.2011
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
Re: /me command -
Laronic - 11.08.2011
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;
}
Re: /me command -
Rabbayazza - 11.08.2011
Can I get a link to it
Re: /me command -
Laronic - 11.08.2011
Sure,
Click me
Re: /me command -
Kush - 11.08.2011
Quote:
Originally Posted by CyberGhost
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(playerid, params[])
{
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /me [text]");
new str[128], new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(str, sizeof(str), "* %s %s", PlayerName, params);
SendLocalChat(playerid,COLOR_PURPLE,str,30.0);
return 1;
}