24.11.2010, 18:32
How can I make it so that you can't see any /me's or chat from another player if they are in a different virtual world?
public OnPlayerText(playerid, text[])
{
new vw = GetPlayerVirtualWorld(playerid);
for(new i; i < MAX_PLAYERS; i++)
{
if(GetPlayerVirtualWorld(i)) == vw) SendPlayerMessageToPlayer(i, playerid, text);
}
stock SendWorldMessage( playerid, color, string[], wid )
{
for ( new i = 0; i < MAX_PLAYERS; i ++ )
{
if ( GetPlayerVirtualWorld( i ) ) == wid ) SendClientMessage( i, color, string );
}
}
stock SendWorldPlayerMessage( playerid, senderid , string[], wid )
{
for ( new i = 0; i < MAX_PLAYERS; i ++ )
{
if ( GetPlayerVirtualWorld( i ) ) == wid ) SendPlayerMessageToPlayer(i, playerid, string);
}
}
public OnPlayerText(playerid, text[])
{
new
vw,
name[MAX_PLAYER_NAME];
vw = GetPlayerVirtualWorld(playerid);
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(text, 128, "%s: %s", name, text);
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i))continue;
if(GetPlayerVirtualWorld(i) == vw)
SendClientMessage(i, GetPlayerColor(playerid), text);//NOTE: getplayercolor will only work if you have used setplayercolor in your script
}
return 0;
}
One that put player names in too,
pawn Код:
|
new vw = GetPlayerVirtualWorld(i);
for(new v = 0; v < MAX_PLAYERS; v++)
{
if(GetPlayerVirtualWorld(v)) == vw)
{
format(string, sizeof(string), "* %s's phone rings.", called);
RingTone[Mobile[i]] = 10;
ProxDetector(30.0, Mobile[v], string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gamemodes\lsrgta.pwn(5477) : error 029: invalid expression, assumed zero C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gamemodes\lsrgta.pwn(5477) : warning 215: expression has no effect C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gamemodes\lsrgta.pwn(5477) : error 001: expected token: ";", but found ")" C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gamemodes\lsrgta.pwn(5477) : error 029: invalid expression, assumed zero C:\Program Files (x86)\Rockstar Games\GTA San Andreas\gamemodes\lsrgta.pwn(5477) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
if(GetPlayerVirtualWorld(i)) == vw)