Seperate Msgs For Virtual Worlds (SOLVED) -
Kayla.S - 05.08.2010
How would I go about making separate server messages for different virtual worlds? I would be using like the standard announcement messages. Which works fine, but don't know where to start for doing seperate ones for different worlds. :/
Re: Seperate Msgs For Virtual Worlds -
Conroy - 05.08.2010
pawn Код:
for(new i; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) {
if(GetPlayerVirtualWorld(i) == 0) {
SendClientMessage(i, COLOR_GREEN, "This message will be sent to everyone in virtual world 0!");
}
}
}
Re: Seperate Msgs For Virtual Worlds -
Hiddos - 05.08.2010
pawn Код:
stock SendClientMessageToWorld(color, msg[], worldid)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || GetPlayerVirtualWorld(i) != worldid) continue;
SendClientMessage(i, color, msg);
}
}
Damn Conroy pwnt me
Re: Seperate Msgs For Virtual Worlds -
Conroy - 05.08.2010
Quote:
Originally Posted by Hiddos
Damn Conroy pwnt me
|
As usual.
Re: Seperate Msgs For Virtual Worlds -
Kayla.S - 05.08.2010
Thanks for the response guys. Sry, but using this for example how would it work using the above code?
http://pastebin.com/aV8PMN5L
Re: Seperate Msgs For Virtual Worlds -
Conroy - 05.08.2010
pawn Код:
enum AnnountmentStructure
{
AnnountmentMessage[128],
Color,
VirtualWorld
}
pawn Код:
new Announcements[][AnnountmentStructure] =
{
{"MESSAGE 1", COLOR_RED, 1},
{"MESSAGE 2", COLOR_RED, 1},
{"MESSAGE 3", COLOR_RED, 1},
{"MESSAGE 4", COLOR_RED, 2},
{"MESSAGE 5", COLOR_RED, 2},
{"MESSAGE 6", COLOR_RED, 2}
};
pawn Код:
public GlobalAnnouncement()
{
new RandMsg = random(sizeof(Announcements));
for(new i; i <= MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(GetPlayerVirtualWorld(i) == Announcements[RandMsg][VirtualWorld]) {
SendClientMessage(i, Announcements[RandMsg][Color], Announcements[RandMsg][AnnouncementMessage]);
}
}
}
return 1;
}
Re: Seperate Msgs For Virtual Worlds -
Kayla.S - 05.08.2010
Thanks alot Conroy, I appreciate it.
Re: Seperate Msgs For Virtual Worlds -
Conroy - 05.08.2010
No problem, here to help.
Re: Seperate Msgs For Virtual Worlds -
Kyle - 05.08.2010
Just a simple public to send messages to the selected world you wish.
pawn Код:
forward SendClientMessageToAllInVirtualWorld(string[],color,worldid);
public SendClientMessageToAllInVirtualWorld(string[],color,worldid)
{
for(new j=0; j<MAX_SERVER_SLOTS; j++)
{
if(IsPlayerConnected(j) && GetPlayerVirtualWorld(j) == worldid)
{
SendClientMessage(j,color,string);
}
}
}
E.G: SendClientMessageToVirtualWorld("This will send to virtual world 2",2,COLOR_RED)
Re: Seperate Msgs For Virtual Worlds -
Hiddos - 05.08.2010
"A simple stock"
You're creating a new public callback XD
BTW, why first the MSG, then the world id, then the color?
SendClientMessage(playerid, color, msg[])
compared to
SendClientMessageToWorld(msg[], worldid, color)
Doesn't makes sense.
Re: Seperate Msgs For Virtual Worlds -
Kyle - 05.08.2010
I was doing a stock, then relised it should be a public. But forgot to change the word stock to public.
Ive fixed it anyways now.
Re: Seperate Msgs For Virtual Worlds -
HuRRiCaNe - 06.08.2010
Hiddos way is better if you are planning to use it for cmds or other things, but seems like conroy's is better for what you looking for