24.03.2015, 11:54
What exactly are you trying to do with these lines
And also this loop will send the nearest player many messages..
If u are trying to send message to all players within range of 10 to playerid then use this
Код:
new idx,string[512],length = strlen(params); while ((idx < length) && (params[idx] <= ' ')) { idx++; } new offset = idx; new result[512]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = params[idx]; idx++; } result[idx - offset] = EOS;
Код:
for (new i = 0; i < GetMaxPlayers(); i++) { i = GetClosestPlayer(playerid); if (IsPlayerConnected(i)) { if (i != playerid) { if (GetDistanceBetweenPlayers(playerid, i) < 10) { SendClientMessage(i,GetPlayerColor(playerid), string); } } } }
Код:
for (new i = 0; i < GetMaxPlayers(); i++) { if (IsPlayerConnected(i)) { if (i != playerid) { if (GetDistanceBetweenPlayers(playerid, i) < 10) { SendClientMessage(i,GetPlayerColor(playerid), string); } } } }