/me around!
#1

Well, all I want is making /me is visible around I meant Global.
Not a chat, I know about it; but I mean /me cause my /me's function shows to everybody in server!

Код:
if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF66FFAA, "USAGE: /me [action]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);
    SendClientMessageToAll(0xFF66FFAA, str);
    return 1;
  }
Reply
#2

You want it just to show to the people around them?
Reply
#3

Ok, i understand you means for people around the player ( )

Use this...
First forward function

Код:
forward PlayerActionMessage(playerid,Float:radius,message[]);
forward ProxDetectorS(Float:radi, playerid, targetid);
Define this:

Код:
#define COLOR_PURPLE 0xC2A2DAAA
Do public variable:

Код:
public PlayerActionMessage(playerid,Float:radius,message[])
{
	new string[128];
	format(string, sizeof(string), "* %s %s", GetPlayerNameEx(playerid), message);
	ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	PlayerActionLog(string);
	return 1;
}

public ProxDetectorS(Float:radi, playerid, targetid)
{
  if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
	{
		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);
		//radi = 2.0; //Trigger Radius
		GetPlayerPos(targetid, posx, posy, posz);
		tempposx = (oldposx -posx);
		tempposy = (oldposy -posy);
		tempposz = (oldposz -posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
		  if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
		  {
				return 1;
			}
		}
	}
	return 0;
}
The code of /me: (OnPlayerCommandText)

Код:
 	if(strcmp(cmd, "/me", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			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_WHITE, "(USAGE) /me [action]");
				return 1;
			}
			new form[128];
			format(form, sizeof(form), "%s",result);
			PlayerActionMessage(playerid,15.0,form);
		}
		return 1;
	}
If it works say thank you

Spanish people know how to code too
Reply
#4

Yeah, I meant people around!
And I will try your code!
Wait for my reply to hear Thank you, only if your code works.
Reply
#5

Код:
(182) : error 017: undefined symbol "idx"
(184) : error 017: undefined symbol "idx"
(184) : warning 215: expression has no effect
(186) : error 017: undefined symbol "idx"
(188) : error 017: undefined symbol "idx"
(190) : error 017: undefined symbol "idx"
(191) : error 017: undefined symbol "idx"
(191) : warning 215: expression has no effect
(193) : error 017: undefined symbol "idx"
(264) : error 017: undefined symbol "GetPlayerNameEx"
(265) : error 017: undefined symbol "ProxDetector"
(266) : error 017: undefined symbol "PlayerActionLog"
I removed bofore the define for idx, can you upload it here ?
Reply
#6

AdrianX9 got it kind of right and gave you extra code that wasnt neeeded just use

at the top
Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
Код:
public 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);
		//radi = 2.0; //Trigger Radius
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(!BigEar[i])
				{
					GetPlayerPos(i, posx, posy, posz);
					tempposx = (oldposx -posx);
					tempposy = (oldposy -posy);
					tempposz = (oldposz -posz);
					//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,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);
					}
				}
				else
				{
					SendClientMessage(i, col1, string);
				}
			}
		}
	}//not connected
	return 1;
}
Код:
if(strcmp(cmd, "/me", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
            new idx;
			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_WHITE, "(USAGE) /me [action]");
				return 1;
			}
			new form[128];
			format(form, sizeof(form), "%s",result);
			ProxDetector(20.0, playerid, form, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
		return 1;
	}
Reply
#7

Sorry Samuel for the extra error
Reply
#8

Quote:
Originally Posted by AdrianX9
Sorry Samuel for the extra error
No! don't be sorry, all I have to say is Thank you, cause you tried to help me!
Reply
#9

Код:
C:\Users\hamza & yassine\Desktop\LV-RP\Gamemodes\LV-RP.pwn(275) : error 017: undefined symbol "BigEar"
C:\Users\hamza & yassine\Desktop\LV-RP\Gamemodes\LV-RP.pwn(275) : warning 215: expression has no effect
C:\Users\hamza & yassine\Desktop\LV-RP\Gamemodes\LV-RP.pwn(275) : error 001: expected token: ";", but found "]"
C:\Users\hamza & yassine\Desktop\LV-RP\Gamemodes\LV-RP.pwn(275) : error 029: invalid expression, assumed zero
C:\Users\hamza & yassine\Desktop\LV-RP\Gamemodes\LV-RP.pwn(275) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Can you please define the "BigEar" ?
Reply
#10

oh sorry forgot about that just put at the top new BigEar[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)