nvm - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: nvm (
/showthread.php?tid=546306)
nvm -
Jimmy0wns - 14.11.2014
-nvm-
Re: nvm -
]Rafaellos[ - 14.11.2014
Get the chosen listitem number in OnDialogResponse, loop again through the database, find the field.
It's not that efficient, it will work tho.
Re: nvm -
tyler12 - 14.11.2014
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];
Re: nvm -
Jimmy0wns - 14.11.2014
Код:
..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;
}