Advertisement
946ben

MyDump - Beispiel

Aug 11th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.55 KB | None | 0 0
  1. #include <a_samp>
  2. #include <mysql>
  3. #include <zcmd>
  4. #define MAX_TABLES 50
  5. #include <MyDump>
  6.  
  7. new MyDump:export;                                                              //Variable für das MyDump-Handle erstellen.
  8.  
  9. public OnFilterScriptInit()
  10. {
  11.     export = MyDumpExportInit("localhost", "root", "*****", "test");            //MyDump initialisieren.
  12.     SetAutoExportTime(3600, export);                                            //Auto-Export-Timer auf 1h stellen.
  13.     SetAutoExportIfNotExists(0, export);                                        //IfNotExists-Option von Auto-Export
  14.                                                                                 //deaktivieren.
  15.     AutoExportTimerStart(export);                                               //Auto-Export-Timer starten.
  16.     return 1;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21.     AutoExportTimerStop(export);                                                //Auto-Export-Timer stoppen.
  22.     MyDumpExportExit(export);                                                   //MyDump deinitialisieren.
  23.     return 1;
  24. }
  25.  
  26. COMMAND:backup(playerid,params[])                                               //Ein Command via ZCMD erstellen.
  27. {
  28.     if(!IsPlayerAdmin(playerid)) return 1;                                      //Falls Spieler kein Admin ist: Abbrechen.
  29.     ExportTablesToFile("export.sql", export, 1);                                //Datenbank zu "export.sql" exportieren
  30.                                                                                 //mit "IF NOT EXISTS"-Zusatz bei
  31.                                                                                 //"CRATE TABLE".
  32.     return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement