27.02.2014, 07:37
pawn Код:
// This command "/registeredplayers" displays the amount of registered players
COMMAND:registeredplayers(playerid, params[])
{
// Setup local variables
new NumPlayers, Msg[128];
// Execute the query to get all ID's from all accounts in table "Accounts"
mysql_query("SELECT ID FROM Accounts");
// Store the result
mysql_store_result();
// Count the amount of rows returned in the result
NumPlayers = mysql_num_rows();
// Free the result
mysql_free_result();
format(Msg, sizeof(Msg), "Registered players: %i", NumPlayers);
SendClientMessage(playerid, -1, Msg);
// Let the server know that this was a valid command
return 1;
}