new cmd[256],idx;
new tmp[256];
cmd = strtok(cmdtext,idx);
if(strcmp(cmd,"/Me",true)==0)
{
new string[256];
new name[24];
new Players = LimitGlobalChatRadius(10);
tmp = strrest(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,0xFF66FFAA," /Me [Text]");
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string)," [Me] %s : %s",name,tmp);
SendClientMessage(Players,0xFFFF00AA,string);
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock strrest(const string[],index)
{
new length = strlen(string),offset = index,result[256];
while((index < length) && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r')) result[index - offset] = string[index],index++;
result[index - offset] = EOS;
if(result[0] == ' ' && string[0] != ' ') strdel(result,0,1);
return result;
}
new Float:x,Float:y,Float:z;
GetPlayerPos(/me cmd maker,x,y,z);
for(..
if(IsPlayerInRangeOfPoint(i,Your Radiuss,x,y,z))
{
SendClientMessage(..
}
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
foreach(Player, i)
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
}
return 1;
}
new
string[128],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, MAX_PLAYER_NAME);
format(string,sizeof(string),"* %s %s ",name,params);
ProxDetector(20.0, playerid, string,COLOR1,COLOR2,COLOR3,COLOR4,COLOR5); // 20 = radius
stock ProxDetector(Float:radi, playerid, string[], color)
{
new Float:posx, Float:posy, Float:posz;
GetPlayerPos(playerid, posx, posy, posz);
foreach (Player, i)
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
if(IsPlayerInRangeOfPoint(i,radi,posx, posy, posz))
{
SendClientMessage(i, color, string);
}
}
}
}
stock SendDoingMessage(playerid, doing[])
{
new Float: emoteX, Float: emoteY, Float: emoteZ, playerName[MAX_PLAYER_NAME], msg[128];
GetPlayerPos(playerid, emoteX, emoteY, emoteZ);
GetPlayerName(playerid, playerName, sizeof(playerName));
format(msg, sizeof(msg), "* %s %s", playerName, doing);
ProxDetector(30.0, playerid, msg, COLOR_PURPLE);
return 1;
}
CMD:me(playerid, params[])
{
new result[128];
if(sscanf(params, "s[128]", result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [text]");
return SendDoingMessage(playerid, result);
}
es\RP.pwn(505) : error 017: undefined symbol "strrest"
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\gamemodes\RP.pwn(505) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\gamemodes\RP.pwn(800) : warning 203: symbol is never used: "me"
new cmd[256],idx;
new tmp[256];
cmd = strtok(cmdtext,idx);
if(strcmp(cmd,"/Me",true)==0)
{
new string[256];
new name[24];
new Players = LimitGlobalChatRadius(10);
tmp = strrest(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,0xFF6C6CFF,"Usage: /me [action]");
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string)," [Me] %s : %s",name,tmp);
SendClientMessage(Players,0xFFFF00AA,string);
return 1;
}
stock ProxDetector(Float:radi, playerid, string[], color)
{
new Float:posx, Float:posy, Float:posz;
GetPlayerPos(playerid, posx, posy, posz);
foreach (Player, i)
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
if(IsPlayerInRangeOfPoint(i,radi,posx, posy, posz))
{
SendClientMessage(i, color, string);
}
}
}
}
stock SendDoingMessage(playerid, doing[])
{
new Float: emoteX, Float: emoteY, Float: emoteZ, playerName[MAX_PLAYER_NAME], msg[128];
GetPlayerPos(playerid, emoteX, emoteY, emoteZ);
GetPlayerName(playerid, playerName, sizeof(playerName));
format(msg, sizeof(msg), "* %s %s", playerName, doing);
ProxDetector(30.0, playerid, msg, COLOR_PURPLE);
return 1;
}
CMD:me(playerid, params[])
{
new result[128];
if(sscanf(params, "s[128]", result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [action]");
return SendDoingMessage(playerid, result);
}
if(!strcmp(cmdtext, "/me", true, 3)) { if(!cmdtext[3])return SendClientMessage(playerid, YELLOW, "USAGE: /me [msg]"); new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "* %s %s", str, cmdtext[4]); SendClientMessage(YELLOW, str); return 1; }
\RP.pwn(505) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\\My Documents\Downloads\samp03bsvr_R2_win32\gamemodes\RP.pwn(797) : warning 203: symbol is never used: "me"
if(!strcmp(cmdtext, "/me", true, 3))
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /me [msg]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
line 505 SendClientMessage(0xFFFFFFAA, str);
return 1;
}
new
string[128],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, MAX_PLAYER_NAME);
format(string,sizeof(string),"* %s %s ",name,params);
ProxDetector(20.0, playerid, string,COLOR1,COLOR2,COLOR3,COLOR4,COLOR5); // 20 = radius
command(me, playerid, params[])
{
new Message[128], string[128];
if( sscanf( params, "s[128]", Message) )
{
SendClientMessage( playerid, COLOR_WHITE, "SYNTAX: /me [action]" );
}
else
{
format( string, sizeof( string ), "* %s %s", GetPlayerNameEx( playerid ), Message);
NearByMessage( playerid, COLOR_PURPLE, string);
}
return 1;
}
forward NearByMessage(playerid, color, String[]);
public NearByMessage( playerid, color, String[])
{
new Float: PlayerX, Float: PlayerY, Float: PlayerZ, string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected( i ))
{
GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ) )
{
if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) && GetPlayerInterior( playerid ) == GetPlayerInterior( i ) )
{
SendClientMessage(i, color, string);
}
}
}
}
return 1;
}
forward NearByMessageEx(playerid, color, String[], Float: range);
public NearByMessageEx( playerid, color, String[], Float: range)
{
new Float: PlayerX, Float: PlayerY, Float: PlayerZ, string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected( i ) )
{
GetPlayerPos( playerid, PlayerX, PlayerY, PlayerZ);
if(IsPlayerInRangeOfPoint(i, range, PlayerX, PlayerY, PlayerZ) )
{
if(GetPlayerVirtualWorld( playerid ) == GetPlayerVirtualWorld( i ) )
{
SendClientMessage(i, color, string);
}
}
}
}
}
stock GetPlayerNameEx(playerid)
{
new str[24], String[128];
GetPlayerName(playerid,String,24);
strmid(str,String,0,strlen(String),24);
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if (str[i] == '_') str[i] = ' ';
}
return str;
}
Here, this should do it.
Notice, this command uses ZCMD and SSCANF2. Change the colors. pawn Код:
pawn Код:
|