Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- •••• • • •••• ••••• ••••• •• •• ••••• •••••
- • • • • • • • • • • • • •
- •••• • • •••• • ••• • • • • ••••• •
- • • • • • • • • • •
- •••• • •••• • ••••• • • ••••• •••••
- */
- #include <a_samp>
- #include <a_mysql>
- #include <YSI\y_commands>
- #define TOTAL_LOGS_SHOWED 3
- new clQuery[1200];
- public OnFilterScriptInit()
- {
- print("\n");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4");
- print(" \4 S32_Changelog \4");
- print(" \4 by \4");
- print(" \4 System32 \4");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\n");
- mysql_connect("localhost", "root", "sa:mp", "");
- mysql_debug(1);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case 31000: return 0;
- }
- return 1;
- }
- YCMD:changelog(playerid, params[], help)
- {
- #pragma unused help
- new id, text[512], Date_Time[6], Final_Date_Time[50];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Only RCON admins can use this!");
- if(sscanf(params, "s[512]", text)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /changelog [Text]");
- if(strlen(text) < 15 || strlen(text) > 512) return SendClientMessage(playerid, 0xFF0000FF, "Text must be between 15 & 512 characters!");
- getdate(Date_Time[0], Date_Time[1], Date_Time[2]);
- gettime(Date_Time[3], Date_Time[4], Date_Time[5]);
- format(Final_Date_Time, sizeof(Final_Date_Time), "%d.%d.%d. %d:%d", Date_Time[2], Date_Time[1], Date_Time[0], Date_Time[3], Date_Time[4], Date_Time[5]);
- SendClientMessage(playerid, -1, "Change log is succesfully updated!");
- mysql_query("SELECT `ID` FROM `changelog` ORDER BY `ID` DESC LIMIT 1");
- mysql_store_result();
- id = mysql_fetch_int();
- id ++;
- mysql_free_result();
- mysql_format(1, clQuery, "INSERT INTO `changelog` (`Text`, `Player`, `Date`, `ID`) VALUES ('%e', '%e', '%e', %d)", text, GetName(playerid), Final_Date_Time, id);
- mysql_query(clQuery);
- return 1;
- }
- YCMD:updates(playerid, params[], help)
- {
- #pragma unused help
- #pragma unused params
- new id, clstring[520 * TOTAL_LOGS_SHOWED], textstr[TOTAL_LOGS_SHOWED][512], player[TOTAL_LOGS_SHOWED][24], date[TOTAL_LOGS_SHOWED][50];
- mysql_query("SELECT * FROM `changelog` ORDER BY `ID` DESC LIMIT "#TOTAL_LOGS_SHOWED"");
- mysql_store_result();
- while(mysql_retrieve_row())
- {
- mysql_fetch_field_row(textstr[id], "Text");
- mysql_fetch_field_row(player[id], "Player");
- mysql_fetch_field_row(date[id], "Date");
- format(clstring, sizeof(clstring), "{FFFFFF}%s %d. {F81414}%s {FFFFFF}- %s {F81414}Posted on: {FFFFFF}%s\n", clstring, id + 1, player[id], textstr[id], date[id]);
- id++;
- }
- ShowPlayerDialog(playerid, 31000, DIALOG_STYLE_MSGBOX, "{FFFFFF} Changelog", clstring, "Ok", "");
- mysql_free_result();
- return 1;
- }
- stock GetName(playerid)
- {
- new PlayerName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
- return PlayerName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement