25.04.2018, 19:12
(
Последний раз редактировалось Phreak; 25.04.2018 в 20:03.
)
PHP код:
new playerName[MAX_PLAYER_NAME];
new query[128];
GetPlayerName(playerid, playerName, sizeof playerName);
mysql_format(db, query, sizeof query, "INSERT INTO `crimes` (`playername`, `commitedcrime`) VALUES ('%e', '%e')", playerName, commitedCrime); // commitedCrime would be the variable where you'd store the crime that the player has commited
mysql_tquerry(db, query);
PHP код:
new playerName[MAX_PLAYER_NAME];
new query[128];
GetPlayerName(playerid, playerName, sizeof playerName);
mysql_format(db, query, sizeof query, "SELECT * FROM `crimes` WHERE `playername` = '%e'", playerName);
mysql_tquery(db, query, "CrimeCallback");
forward CrimeCallback();
public CrimeCallback(){
new rows_found = cache_num_rows();
if(rows_found > 0){
new crimesArray[rows_found]; // edited
for(var i=0; i<rows_found;i++){
cache_get_value_name(i, "commitedcrime", crimesArray[i], max_size_of_crime);
}
format(bla bla bla, crimesArray[0],crimesArray[1]...);
ShowPlayerDialog(bla bla bla, the_formatted_string);
} else {
ShowPlayerDialog(bla bla bla, "No crimes commited");
}
}