Help with chat
#1

pawn Код:
new
    world = GetPlayerVirtualWorld(playerid);
  for (new i; i < MAX_PLAYERS; i++)
  {
    if (world == GetPlayerVirtualWorld(i))
    {
      SendPlayerMessageToPlayer(i, playerid, text);
    }
  }
OK, I want to limit chat to people in worlds. Now saying that world 0 is the main world everybody in that world should be able to see chat from everybody in that world, they should not see chat from people in other virtual worlds and the people in those worlds should not see chat from any other worlds.

If I use the above code, it repeats everything twice in mainchat. Help?
Reply
#2

add return 0;
Reply
#3

Already tried that, if I add return 0 it doesn't show any chat at all.
Reply
#4

Quote:
Originally Posted by » Pawnst★r «
Already tried that, if I add return 0 it doesn't show any chat at all.
String?
Reply
#5

Quote:
Originally Posted by Abernethy([url
www.abernethy.smfnew.com[/url]) ]
Quote:
Originally Posted by » Pawnst★r «
Already tried that, if I add return 0 it doesn't show any chat at all.
String?
... What?
Reply
#6

Bump, can anybody help me with this ...
Reply
#7

This is just a total guess. Don't know if it will work but give it a try. :P

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new name[MAX_PLAYERS];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"-> World Chat(%s): %s", name, cmdtext);
    SendMessageToMyWorld(0xFFFF00AA, string) return true;
    return false;
}
pawn Код:
SendMessageToMyWorld(color, text[])
{

    new world;
    world = GetPlayerVirtualWorld(playerid);
  for (new i; i < MAX_PLAYERS; i++)
  {
    if (world == GetPlayerVirtualWorld(i))
    {
            SendClientMessage(i, color, text);
    }
  }
}
Let me know.
Reply
#8

Didn't work .. thanks anyway. I just want it to like, say your in another world .. and I am in world 0 .. if I talk you won't see my chat and if you talk I won't see your chat ... but then say if your freind joins your world he can see your chat because he's in the same world .. but again .. I can't. Surely it can't be that hard .. I am just too inexperienced in PAWN to contemplate it.
Reply
#9

pawn Код:
public OnPlayerText(playerid, text[])
{
    new name[MAX_PLAYERS];
     new str[256];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),"-> World Chat(%s): %s", name, cmdtext);
    SendMessageToMyWorld(0xFFFF00AA, str) return true;
    return false;
}
pawn Код:
SendMessageToMyWorld(color, text[])
{

    new world;
    world = GetPlayerVirtualWorld(playerid);
  for (new i; i < MAX_PLAYERS; i++)
  {
    if (world == GetPlayerVirtualWorld(i))
    {
            SendClientMessage(i, color, text);
    }
  }
}
forget the onplayercommandtext
OnPlayerTExt is for the Chat
CommandText is only for commands

didn't test
if it gives errors tell me ill try to fox em then
~SaiBerFun
Reply
#10

Doesn't work ... because:

pawn Код:
SendMessageToMyWorld(color, text[])
{

    new world;
    world = GetPlayerVirtualWorld([b]playerid[/b]); // playerid isn't defined anywhere o_o
  for (new i; i < MAX_PLAYERS; i++)
  {
    if (world == GetPlayerVirtualWorld(i))
    {
            SendClientMessage(i, color, text);
    }
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)