My chats don't seem to be working...
#1

Heres what i have for /me /o and /b, but i can't seem to get them working.

Код:
 if(!strcmp(cmdtext, "/me", true, 4))
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [ACTION]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 40.0, x, y, z))
{
SendClientMessage(i, 0xFFFF00AA, str);
}
}
}
return 1;
}

// GOOC
if(!strcmp(cmdtext, "/o", true, 4))
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /o [MESSEGE]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "[GOOC] %s : %s", str, cmdtext[4]);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 2000.0, x, y, z))
{
SendClientMessage(i, 0xFFFF00AA, str);
}
}
}
return 1;
}


// local OOC
if(!strcmp(cmdtext, "/b", true, 4))
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /b [MESSEGE]");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "[LOCAL OCC] %s : %s", str, cmdtext[4]);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 60.0, x, y, z))
{
SendClientMessage(i, 0xFFFF00AA, str);
}
}
}
return 1;
}
Reply
#2

use that for /me :

Код:
//------------------------------------------------------------------------------------------------------
	if(!strcmp(cmdtext, "/me", true, 3))
  {
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /me [Text]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    SendClientMessageToAll(0xFFFF00AA, str);
    return 1;
  }
//------------------------------------------------------------------------------------------------------
Reply
#3

Maybe I could use that for /o because its global. Thanks.

Doesn't work.
Reply
#4

weird , it work in my server
Reply
#5

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new
    idx,
    cmd[128];

  cmd = strtok(cmdtext, idx);

  if(strcmp(cmd, "/me", true) == 0)
  {
    new
      Float:x,
      Float:y,
      Float:z,
      pName[24],
      act[128],
      tmp[128];
         
    tmp = strtok(cmdtext, act);
    if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR, "Usage: /me [action]");
    else if(0 > strlen(act) > 107) return SendClientMessage(playerid, COLOR, "The test must be between 1 and 107 characters long!");
    else
    {
      GetPlayerPos(playerid, x, y, z);
      GetPlayerName(playerid, pName, sizeof(pName));
      format(tmp, sizeof(tmp), "* %s %s", pName, tmp);
      for(new i = 0; i < MAX_PLAYERS; i ++)
      {
        if(IsPlayerConnected(i) && IsPlayerInRageOfPoint(i, 40.0, x, y, z))
        {
          SendClientMessage(i, COLOR, tmp);
        }
      }
    }
    return 1;
  }
  return 0;
}
Reply
#6

strtok is utterly useless for this command.

pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
  if(!strcmp(cmdtext[1],"me",true,strlen("me")))
  {
    if(!cmdtext[4])return SendClientMessage(playerid,0xAAAAAAFF,"USAGE: /Me <action>");
    new Float:x,Float:y,Float:z,tmpstr[134];
    GetPlayerName(playerid,tmpstr,24);
    format(tmpstr,134,"** %s %s **",tmpstr,strlen("me")+2);
    GetPlayerPos(playerid,x,y,z);
    for(new ply;ply<MAX_PLAYERS;ply++)
    {
      if(IsPlayerInRangeOfPoint(ply,10.0,x,y,z))SendClientMessage(playerid,0xAAAA99FF,tmpstr);
    }
    return 1;
  }
  return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)