Local chat only in its Virtual World
#1

Hello, i would like to know how is it possible that players who are not in same Virtual World but on same position/location can't see the local text?

pawn Код:
if(strcmp(cmd, "/l", true) == 0 || strcmp(cmd, "/local", true) == 0)
    {
        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: (/l)ocal");
            return 1;
        }
        format(string, sizeof(string), "* %s says: %s", sendername, result);
        ProxDetector(12.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        printf("%s", string);
        return 1;
    }
Here is the code, i tried adding stuff to it but it failed.
This one works well until i see people in same houses/interiors but in other virtual world can see each other Local Chats.


Thanks in advance and i hope someone helps me here

Reply
#2

As much as I'd hate giving this away but the way to do it is changing ProxDetector. Replace
public ProxDetector to the one I modded to only chat in same Virtual World....
Код:
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);
		new VW = GetPlayerVirtualWorld(playerid);
		//radi = 2.0; //Trigger Radius
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(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 (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
					{
						SendClientMessage(i, col1, string);
					}
					else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
					{
						SendClientMessage(i, col2, string);
					}
					else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
					{
						SendClientMessage(i, col3, string);
					}
					else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
					{
						SendClientMessage(i, col4, string);
					}
					else if (((GetPlayerVirtualWorld(i)==VW && tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
					{
						SendClientMessage(i, col5, string);
					}
			}
		}
	}//not connected
	return 1;
}
Just Copy Paste that over the old public and you should get the results you want. Only thing is it will change ALL your prox chats to only talk in the same VW.

With Love,
~The Reymon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)