LoadPlayerFines(); format(finelist,sizeof(finelist),"Amenda #%d [{4747D1}$%d{FFFFFF}] pentru '%s'",FinesInfo[playerid][fId],FinesInfo[playerid][fPret],FinesInfo[playerid][fPentru]); ShowPlayerDialog(playerid, 432,DIALOG_STYLE_LIST,"Fines", finelistt, "Detalii", "Close");
if( IsPlayerConnected( playerid ) ) { new DataString[ 1536 ], Query[ 1536 ], sendername[256]; GetPlayerName(playerid, sendername, sizeof(sendername)); format( Query, sizeof( Query ), "SELECT * FROM `fines` WHERE `Inssuer` = '%s'", sendername); if(mysql_query( Query )) { mysql_store_result(); } else { mysql_free_result(); SendClientMessage( playerid, COLOR_WHITE, "MYSQL ERROR LAV, feel free to report this bug by SS'ing it and send it to a dev." ); printf("Could not call loadaccountvariables query %d %d",playerid,PlayerInfo[playerid][pDatabaseID]); Kick(playerid); } printf(" SQL: %s",Query); for(new fine;fine<MAX_FINES;fine++) { mysql_fetch_field( "ID", DataString ); FinesInfo[ playerid ][ fId ] = strval( DataString ); mysql_fetch_field( "Price", DataString ); FinesInfo[ playerid ][ fPrice ] = strval( DataString ); mysql_fetch_field( "For", DataString ); strmid(FinesInfo[ playerid ][ fFor ], DataString, 0, strlen(DataString), 255); } mysql_free_result(); }
GetPlayerName(playerid, sendername, sizeof(sendername)); new query[300],query1[300],query2[300],query3[300],query4[300], userstring[300]; format(query, sizeof(query), "SELECT * FROM fines WHERE Posesor = '%s' ORDER BY ID DESC LIMIT 10", sendername); mysql_query(query); mysql_store_result(); while(mysql_num_rows()) { mysql_fetch_row(query, "ID"); mysql_fetch_row(query1, "Inssuer"); mysql_fetch_row(query2, "Price"); mysql_fetch_row(query3, "For"); format(userstring, sizeof(userstring), "Fine #%d [{4747D1}$%d{FFFFFF}] for '%s'", query, query1, query2, query3); } mysql_free_result(); ShowPlayerDialog(playerid, 432,DIALOG_STYLE_LIST,"Fines", userstring, "Details", "Close"); return 1;
You'll have to store the player's name when storing as well, so you can track the ID, you could do it simpler, check for tickets that match the players name.
|
new FinesInfo[MAX_PLAYERS][MAX_FINES][e_FinesInfo /* REPLACE WITH THE NAME OF THE ENUM IS USED TO THE SCRIPT */];
for(new fine, rows = mysql_num_rows(sql);fine<rows;fine++)
{
if (fine >= sizeof (FinesInfo)) break;
mysql_fetch_field( "ID", DataString );
FinesInfo[ playerid ][fine][ fId ] = strval( DataString );
mysql_fetch_field( "Price", DataString );
FinesInfo[ playerid ][fine][ fPrice ] = strval( DataString );
mysql_fetch_field( "For", DataString );
strmid(FinesInfo[ playerid ][fine][ fFor ], DataString, 0, strlen(DataString), 255);
}
// NOTE: finelist should be long enough to store the whole text
for(new fine;fine<MAX_FINES;fine++)
{
if (!FinesInfo[ playerid ][fine][ fFor ]) break;
format(finelist,sizeof(finelist),"%sAmenda #%d [{4747D1}$%d{FFFFFF}] pentru '%s'",finelist,FinesInfo[playerid][fine][fId],FinesInfo[playerid][fine][fPrice],FinesInfo[playerid][fine][fFor]);
}
ShowPlayerDialog(playerid, 432,DIALOG_STYLE_LIST,"Fines", finelistt, "Detalii", "Close");
format(stringf,sizeof(stringf), "{FFFFFF}Agency: {4747A3}Los Santos Police Departament\n{FFFFFF}Addressee:{4747A3} %s\n{FFFFFF}Fine Inssuer: {4747A3} %s \n\n", sendername,FinesInfo[playerid][listitem][fPolitist]);
format(stringf2,sizeof(stringf2), "{FFFFFF}Amount:{4747A3}$%d\n{FFFFFF}Reason:{4747A3} %s\n",FinesInfo[playerid][listitem][fPret],FinesInfo[playerid][listitem][fPentru]);