28.09.2010, 11:57
I was trying to make a /me command, but it doesn't work, no warnings, when I type /me and the message nothing happens, what I want is that players that in a close Radius of a guy who is about to say something on /me would be able to see it, can you check the script and correct, I don't want that to be Global to the whole server.
And this placed in the bottom of the script :
PHP код:
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;
}
PHP код:
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;
}