08.04.2018, 03:41
PHP код:
public OnPlayerText(playerid, text[])
{
new string[144];
if(text[0] == '@' && Account[playerid][Admin] >= 1)
{
format(string, sizeof(string), "** |Admin Chat| %s: %s **", IsPlayerName(playerid), text[1]);
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(IsPlayerConnected(i) && Account[i][Admin] >= 1)
SendClientMessage(i, 0x0AFFC9FF, string);
}
return 0;
}
if(text[0] == '!' && Account[playerid][Vip] >= 1)
{
format(string, sizeof(string), "~> |Vip Chat| %s: %s <~", IsPlayerName(playerid), text[1]);
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(IsPlayerConnected(i) && Account[i][Vip] >= 1)
SendClientMessage(i, 0xFF0099AA, string);
}
return 0;
}
new var = GetPlayerVirtualWorld(playerid), pl_color = GetPlayerColor(playerid);
format(string, sizeof(string), "%s (%d): {FFFFFF}%s", IsPlayerName(playerid), playerid, text);
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(!IsPlayerConnected(i) || GetPlayerVirtualWorld(i) != var) continue;
SendClientMessage(i, pl_color, string);
}
return 0;
}
https://sampwiki.blast.hk/wiki/Control_Structures#return
Also, I've changed your loops to make use of the function 'GetPlayerPoolSize' which returns the highest player ID being used on your server.
https://sampwiki.blast.hk/wiki/GetPlayerPoolSize