Help with chat - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with chat (
/showthread.php?tid=98592)
Help with chat -
ded - 21.09.2009
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?
Re: Help with chat -
xCoder - 22.09.2009
add return 0;
Re: Help with chat -
ded - 22.09.2009
Already tried that, if I add return 0 it doesn't show any chat at all.
Re: Help with chat -
Abernethy - 22.09.2009
Quote:
Originally Posted by » Pawnst★r «
Already tried that, if I add return 0 it doesn't show any chat at all.
|
String?
Re: Help with chat -
ded - 22.09.2009
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?
Re: Help with chat -
ded - 23.09.2009
Bump, can anybody help me with this ...
Re: Help with chat -
member - 23.09.2009
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.
Re: Help with chat -
ded - 23.09.2009
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.
Re: Help with chat -
saiberfun - 23.09.2009
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
Re: Help with chat -
ded - 23.09.2009
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);
}
}
}