#1

pawn Код:
forward PlayerCharacterCount(playerid);
public PlayerCharacterCount(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(MasterAccount[playerid][mLoggedIn])
        {
            new query[64];
            format(query, sizeof(query), "SELECT * FROM `PlayerCharacter` WHERE ( `owner_id` = '%d' )", MasterAccount[playerid][mID]);
            mysql_query(1, query);
            cache_get_field_content(0, "", query);
            count = cache_get_field_content(query);
           
            /*qresult = db_query(database, query);
           
            db_free_result(qresult);*/

        }
    }
    return count;
}
it returns these errors:
pawn Код:
MyProject.pwn(700) : error 017: undefined symbol "count"
MyProject.pwn(700) : error 035: argument type mismatch (argument 1)
MyProject.pwn(707) : error 017: undefined symbol "count"
It basically returns how many Characters a player has on his 'Master account'. I can't get it to work though. :/
Reply
#2

pawn Код:
forward PlayerCharacterCount(playerid);
public PlayerCharacterCount(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(MasterAccount[playerid][mLoggedIn])
        {
            new query[64],count;
            format(query, sizeof(query), "SELECT * FROM `PlayerCharacter` WHERE ( `owner_id` = '%d' )", MasterAccount[playerid][mID]);
            mysql_query(1, query);
            cache_get_field_content(0, "", query);
            count = cache_get_field_content(query);
           
            /*qresult = db_query(database, query);
           
            db_free_result(qresult);*/

        }
    }
    return count;
}
Reply
#3

It didn't work.

pawn Код:
MyProject.pwn(700) : error 035: argument type mismatch (argument 1)
MyProject.pwn(700) : warning 204: symbol is assigned a value that is never used: "count"
MyProject.pwn(707) : error 017: undefined symbol "count"
Reply
#4

Yes, I added new count;
Reply
#5

Try this?
pawn Код:
forward PlayerCharacterCount(playerid);
public PlayerCharacterCount(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(MasterAccount[playerid][mLoggedIn])
        {
            new query[64], count=0;
            format(query, sizeof(query), "SELECT * FROM `PlayerCharacter` WHERE ( `owner_id` = '%d' )", MasterAccount[playerid][mID]);
            mysql_query(1, query);
            cache_get_field_content(0, "", query);
            count = cache_get_field_content(query);
           
            /*qresult = db_query(database, query);
           
            db_free_result(qresult);*/

        }
    }
    return count;
}
Reply
#6

Nope..
Reply
#7

If you're about to use a non-threaded query, that's not how it should be: https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_query
Reply
#8

What would I use then, if I were to use caching?
Reply
#9

That's why I directed you to that link to see the example:
pawn Код:
new Cache:result = mysql_query(...);
// cache functions to check whether there are rows and if so, retrieve the data..
cache_delete(result);
Reply
#10

Which function of cache do I use though?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)