A not working command
#1

Any ideas why it shows me 0 when the accounts are not 0 ?

pawn Код:
CMD:accounts(playerid, params[])
{
    new query[128], string[128];
    format(query, sizeof(query), "SELECT COUNT(`ID`) FROM `players`");
    mysql_function_query(IMDb, query, false, "", "");
    format(string, sizeof(string),"» Total accounts: %i «", mysql_num_rows());
    SendClientMessage(playerid, -1, string);
    return 1;
}
Reply
#2

What are you exactly trying to accomplish here?

Be specific as what you're doing could be affiliated with a lot of things.
Reply
#3

Im trying to make a command which shows the amount of all registered accounts on my server and also I ran the code in phpmyadmin and it returns the right number.
Reply
#4

That's not how you use threaded queries.

pawn Код:
forward public CallbackName(playerid);

public CallbackName(playerid)
{
    new rowCount, fieldCount;
    cache_get_data(rowCount, fieldCount, IMDb);

    format(string, sizeof(string),"» Total accounts: %i «", rowCount);
    SendClientMessage(playerid, -1, string);
    return 1;
}

mysql_function_query(IMDb, query, true, "CallbackName", "i", playerid);
Reply
#5

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
That's not how you use threaded queries.

pawn Код:
forward public CallbackName(playerid);

public CallbackName(playerid)
{
    new rowCount, fieldCount;
    cache_get_data(rowCount, fieldCount, IMDb);

    format(string, sizeof(string),"» Total accounts: %i «", rowCount);
    SendClientMessage(playerid, -1, string);
    return 1;
}

mysql_function_query(IMDb, query, true, "CallbackName", "i", playerid);
I can't get why I should use threaded query to count the registered accounts and my problem was that it shows 0 accounts, when they were 285 also when I executed the code in phpmyadmin it showed me 285.
Reply
#6

Nice mappings :0
Reply
#7

Quote:
Originally Posted by Sweez
Посмотреть сообщение
Nice mappings :0
Thanks, but this thread is not about the maps
Reply
#8

Quote:
Originally Posted by x96664
Посмотреть сообщение
Any ideas why it shows me 0 when the accounts are not 0 ?

pawn Код:
CMD:accounts(playerid, params[])
{
    new query[128], string[128];
    format(query, sizeof(query), "SELECT COUNT(`ID`) FROM `players`");
    mysql_function_query(IMDb, query, false, "", "");
    format(string, sizeof(string),"» Total accounts: %i «", mysql_num_rows());
    SendClientMessage(playerid, -1, string);
    return 1;
}
Bump.
Reply
#9

Quote:
Originally Posted by x96664
Посмотреть сообщение
Bump.
Why are you bumping when SuperViper has already given an answer to your problem?
Reply
#10

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Why are you bumping when SuperViper has already given an answer to your problem?
Because that code messed up with my server things and when I logged and spawned I died and commands weren't working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)