MySQL Registered Players!
#5

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;
}
Something like this should work.
Reply


Messages In This Thread
MySQL Registered Players! - by Mriss - 27.02.2014, 06:32
Re: MySQL Registered Players! - by Mriss - 27.02.2014, 06:34
Re: MySQL Registered Players! - by PowerPC603 - 27.02.2014, 07:16
Re: MySQL Registered Players! - by Mriss - 27.02.2014, 07:28
Re: MySQL Registered Players! - by PowerPC603 - 27.02.2014, 07:37
Re: MySQL Registered Players! - by Vince - 27.02.2014, 10:19
Re : MySQL Registered Players! - by anou1 - 27.02.2014, 13:06
Re: MySQL Registered Players! - by Misiur - 27.02.2014, 13:13

Forum Jump:


Users browsing this thread: 2 Guest(s)