Please help me with local chat
#1

I don't know how to make local OOC and IC chat /l /b. Can someone help me please
Reply
#2

You can probably use PlayerToPoint, although I haven't tried it yet.
Reply
#3

Look at Godfather and Penls, note how that one is mad, I recall it being called "Proxdetector" or something...
Reply
#4

Just make a normal OOC, but change it to local and use LimitGlobalChatRadius(20); is a good radius.
Reply
#5

Do not use LimitGlobalChatRadius. I will show you what to do instead.

pawn Код:
if(strcmp(cmd, "/b", true) == 0)
  {
    new str[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
        idx++;
    }
    new offset = idx;
    new result[128];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
        result[idx - offset] = cmdtext[idx];
        idx++;
    }
    result[idx - offset] = EOS;

    if(!strlen(result))
    {
      PlayerMessage(playerid, lime1, "/s [shout text]");
      return 1;
    }

    format(str, sizeof(str), "((%s says : %s ))", name, result);
    ProxDetector(15.0, playerid, str, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
    return 1;
  }
You will need the ProxDetector function in your script which I will post here.
pawn Код:
forward ProxDetector(Float:radi, playerid, string[], col1, col2, col3, col4, col5); // The forward

public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)    // The Callback
{
    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);
        for(new i = 0; i <=GetMaxPlayers();)
        {
            if(IsPlayerConnected(i))
            {
                if(!EarShot[i])
                {
                    GetPlayerPos(i, posx, posy, posz);
                    tempposx = (oldposx -posx);
                    tempposy = (oldposy -posy);
                    tempposz = (oldposz -posz);
                    if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                    {
                        PlayerMessage(i, col1, string);
                    }
                    else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                    {
                        PlayerMessage(i, col2, string);
                    }
                    else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                    {
                        PlayerMessage(i, col3, string);
                    }
                    else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                    {
                        PlayerMessage(i, col4, string);
                    }
                    else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        PlayerMessage(i, col5, string);
                    }
                }
                else
                {
                    PlayerMessage(i, col1, string);
                }
            }
            i++;
        }
    }
    return 1;
}
Reply
#6

You changed stuff in ProxDetector.. Also it won't be good if the players have other Virtual Worlds, they'll see each other's messages.
Reply
#7

I get this errors:

Quote:

C:\Users\Arturo\Desktop\FC-RP\Servidor\gamemodes\FC-RP.pwn(56) : error 017: undefined symbol "EarShot"
C:\Users\Arturo\Desktop\FC-RP\Servidor\gamemodes\FC-RP.pwn(56) : warning 215: expression has no effect
C:\Users\Arturo\Desktop\FC-RP\Servidor\gamemodes\FC-RP.pwn(56) : error 001: expected token: ";", but found "]"
C:\Users\Arturo\Desktop\FC-RP\Servidor\gamemodes\FC-RP.pwn(56) : error 029: invalid expression, assumed zero
C:\Users\Arturo\Desktop\FC-RP\Servidor\gamemodes\FC-RP.pwn(56) : fatal error 107: too many error messages on one line

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)