13.12.2015, 18:46
pawn Код:
forward OnPrison_Check(playerid);
public OnPrison_Check(playerid){
new rows, fields, officer, timestamp, time, year, month, day, hour, minute, second, cstr[1024];
cache_get_data(rows, fields, sqlConnection);
if(!cache_num_rows()){ format(cstr, sizeof(cstr), "No records to display."); }
for(new i = 0; i <= cache_num_rows(); i++){
officer = cache_get_field_content_int(i, "officerID", sqlConnection);
timestamp = cache_get_field_content_int(i, "timeStamp", sqlConnection);
time = cache_get_field_content_int(i, "Length", sqlConnection);
timeToDate(timestamp, hour, minute, second, year, month, day);
format(cstr, sizeof(cstr), "%s[%02d/%02d | %02d:%02d - (%02d minutes)] - By %s\n", cstr, day, month, hour, minute, time, GetPlayerNameFromSQL(officer));
}
format(str, sizeof(str), "%s - Arrest Log", mdcPlayer[playerid]);
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_LIST, str, cstr, "Ok", "");
return 1;
}
query is:
pawn Код:
mysql_format(sqlConnection, query, sizeof(query), "SELECT * FROM `prisons` WHERE `playerID`=%d", GetPlayerIDFromSQL(mdcPlayer[playerid]));
mysql_pquery(sqlConnection, query, "OnPrison_Check", "i", playerid);