Not maybe, it is 100% sure, get_players make checks internally, when the second way has to check if each player is connected, so maxclient * is_user_connected natives calls for nothing.
Anyway, if it is just to print a message, you can send 1 message to everyone :
client_print(0, print_chat, "Your message with some patterns like %s", szName)
Or you can make your own if it is justified :
PHP Code:
print_message(id, const msg[])
{
message_begin(id ? MSG_ONE : MSG_ALL, gmsgSayText, _, id)
write_byte(id)
write_string(msg)
message_end()
}
print_message_format(id, const fmt[], any:...)
{
new msg[192]
vformat(msg, charsmax(msg), fmt, 3)
message_begin(id ? MSG_ONE : MSG_ALL, gmsgSayText, _, id)
write_byte(id)
write_string(msg)
message_end()
}
Anyway, do never use code #1, never.
And about code #2, in your example, 'player' variable is not required because you use it only once, so you can directly use players[i] instead. 'player' is usefull for optimization to prevent multiple use of players[i] (called re-indexing if you read wiki about optimizations).
__________________