Local /me command script.
#1

Hi, I'm using PAWNO and I'm looking for a LOCAL /me command that only players withing a short radius are able to see.
Just like the LimitGlobalChatRadius command, I've tried other scripts but they where global.
I've searched the forums but I haven't found anything.

Thankyou.
Reply
#2

pawn Код:
if(strcmp(cmd, "/me", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(gPlayerLogged[playerid] == 0)
        {
          SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet !");
          return 1;
        }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [action]");
                return 1;
            }
            if(PlayerInfo[playerid][pMaskuse] == 1)
            {
              format(string, sizeof(string), "* Stranger %s", result);
            }
            else
            {
                format(string, sizeof(string), "* %s %s", sendername, result);
            }
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            printf("%s", string);
        }
        return 1;
    }
Displays as purple /me, like many RP servers do.
Reply
#3

Thank you but where should I put this?
Reply
#4

Quote:
Originally Posted by Waynewayne
Thank you but where should I put this?
That piece of code should go under

Код:
public OnPlayerCommandText(playerid, cmdtext[])
So something like this
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmd, "/me", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 0)
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet !");
	      return 1;
	    }
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [action]");
				return 1;
			}
			if(PlayerInfo[playerid][pMaskuse] == 1)
			{
			  format(string, sizeof(string), "* Stranger %s", result);
			}
			else
			{
				format(string, sizeof(string), "* %s %s", sendername, result);
			}
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			printf("%s", string);
		}
		return 1;
		
	return 0;
}
Reply
#5

Quote:
Originally Posted by Everybody
pawn Код:
if(strcmp(cmd, "/me", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(gPlayerLogged[playerid] == 0)
        {
          SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
          return 1;
        }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /me [action]");
                return 1;
            }
            if(PlayerInfo[playerid][pMaskuse] == 1)
            {
              format(string, sizeof(string), "* Stranger %s", result);
            }
            else
            {
                format(string, sizeof(string), "* %s %s", sendername, result);
            }
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            printf("%s", string);
        }
        return 1;
    }
Displays as purple /me, like many RP servers do.
That is taken STRAIGHT out of GF, and he may not have the gLogged or pMaskuse so here's my:
Nice and simple.

pawn Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(!cmdtext[3])
        SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
        {
    new string[128];
    GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), "* %s %s", string, cmdtext[4]);
    ProxDetector(30, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
 return 1;
}
Reply
#6

I'm getting errors, what might be the problem?
Reply
#7

Post the errors, so we can see.
Reply
#8

Nevermind, thanks all!
Reply
#9

This is how it looks and I'm still getting errors.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(!cmdtext[3])
SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
{
    new string[128];
    GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), "* %s %s", string, cmdtext[4]);
    ProxDetector(30, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
 return 1;
}

  return 1;
}
I'm pretty new at this btw...
Reply
#10

Are you getting this error?;
Код:
error 017: undefined symbol "ProxDetector"
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)