09.06.2012, 15:44
Help, how to make a world system, messages sent will receive only those in my own world ?
I tried to do it myself but I could not...
I tried to do it myself but I could not...
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
new str[128];
format(str, sizeof(str), "%s says: %s", GetPlayerName(playerid), text);
SendClientMessage(i, -1, str);
}
return 0;
}
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
SendClientMessage(i,-1,text);
}
}
}
return 0;
pawn Код:
|
whats wrong with that, besides where he has the return 0;
that should be at the end of the callback not in the loop... and GetPlayerName(playerid) cannot be used like that |
new name[24];
GetPlayerName(playerid, name, sizeof(name));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
new str[128];
format(str, sizeof(str), "%s says: %s", name, text);
SendClientMessage(i, -1, str);
}
}
}
return 0;