#1

-nvm-
Reply
#2

Get the chosen listitem number in OnDialogResponse, loop again through the database, find the field.

It's not that efficient, it will work tho.
Reply
#3

pawn Код:
new CrewList[MAX_PLAYERS][MAX_GANGS];

CMD:crews(playerid, params[])
{
    new query[300], userstring[300], n;
    new crewname[300], crewbalance[300];
    format(query, sizeof(query), "SELECT * FROM crews ORDER BY name ASC");
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row(query))
    {
        mysql_fetch_string("name", crewname);
        mysql_fetch_string("balance", crewbalance);
        format(userstring, sizeof(userstring), "%s%s ($%s) \n",userstring,crewname,crewbalance);
        CrewList[playerid][n] = id; // get the id from the database
        n++;

    }
    mysql_free_result();
    ShowPlayerDialog(playerid,crews,DIALOG_STYLE_LIST,"Crews",userstring,"Continue","Close");
    return 1;
}

OnDialogResponse:
new id = CrewList[playerid][listitem];
Reply
#4

Код:
..pwn(2956) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Current code:
pawn Код:
CMD:crews(playerid, params[])
{
    new query[300], userstring[300], n;
    new crewname[300], crewbalance[300];
    new crewid;
    format(query, sizeof(query), "SELECT * FROM crews ORDER BY name ASC");
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row(query))
    {
        mysql_fetch_string("name", crewname);
        mysql_fetch_string("balance", crewbalance);
        mysql_fetch_string("id", crewid);
        format(userstring, sizeof(userstring), "%s%s ($%s) \n",userstring,crewname,crewbalance);
        CrewList[playerid][n] = crewid; // get the id from the database
        n++;
    }
    mysql_free_result();
    ShowPlayerDialog(playerid,crews,DIALOG_STYLE_LIST,"Crews",userstring,"Continue","Close");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)