daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Oct 16th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. player varijabla, ja nju koristio da ne cackam enum, ti kako os - new PNotes[MAX_PLAYERS];
  2.  
  3. sql_AccountCheck:
  4.  
  5. cache_get_value_name_int(0, "PNotes", PNotes[playerid]);
  6.  
  7. dialog enum:
  8.  
  9.     D_NOTE,
  10.     D_NOTE_LIST,
  11.     D_NOTE_DELETE,
  12.     D_NOTE_PREVIEW,
  13.  
  14.  
  15. OnDialogResponse:
  16.  
  17.     else if(dialogid == D_NOTE && response)
  18.     {
  19.         new DB_query_note[128];
  20.         switch(listitem)
  21.         {
  22.             //case 0: SPD(playerid, D_INSERT_TITLE, DSI, "Note - ubacivanje", "Unesite naslov beleske\n\n", "OK", "X");
  23.             case 0:
  24.             {
  25.                 mysql_format(SQL, DB_query_note, sizeof DB_query_note, "SELECT Title, Text , ID FROM `notes` WHERE Player = '%s' ORDER BY `ID` DESC LIMIT 20", GetName(playerid));
  26.                 mysql_tquery( SQL, DB_query_note, "DialogNotes", "ii", playerid, 1);
  27.             }
  28.             case 1:
  29.             {
  30.                 mysql_format(SQL, DB_query_note, sizeof DB_query_note, "SELECT Title, Text , ID FROM `notes` WHERE Player = '%s' ORDER BY `ID` DESC LIMIT 20", GetName(playerid));
  31.                 mysql_tquery( SQL, DB_query_note, "DialogNotes", "ii", playerid, 2);
  32.             }
  33.         }
  34.     }
  35.     else if(dialogid == D_NOTE_DELETE)
  36.     {
  37.         new DB_query_note[128];
  38.         mysql_format(SQL, DB_query_note, sizeof DB_query_note, "SELECT Title, Text , ID FROM `notes` WHERE Player = '%s' ORDER BY `ID` DESC LIMIT 20", GetName(playerid));
  39.         mysql_tquery( SQL, DB_query_note, "DeleteNotes", "ii", playerid, listitem-1);
  40.     }
  41. funkcije:
  42.  
  43. forward DeleteNotes(playerid, row);
  44. public DeleteNotes(playerid, row)
  45. {
  46.     new str[128];
  47.     mysql_format(SQL, str, sizeof str, "DELETE FROM notes WHERE ID = '%d'", row);
  48.     mysql_tquery(SQL, str);
  49.     PNotes[playerid]--;
  50.     SacuvajIgracaInt(playerid, "PNotes", PNotes[playerid]);
  51.     return 1;
  52. }
  53.  
  54. forward DialogNotes(playerid, type);
  55. public DialogNotes(playerid, type)
  56. {
  57.     new tajtl[24], beleska[128], dialog_str[1024];
  58.     for(new id=0;id<cache_num_rows();id++)
  59.     {
  60.         cache_get_value(id, "Title", tajtl, 24);
  61.         cache_get_value(id, "Text", beleska, 128);
  62.         if(type == 1)
  63.             format(dialog_str, sizeof dialog_str, "%s{FFFFFF}ID %d: {FFFF00}%s | {FFFFFF}%s\n",dialog_str, id+1, tajtl, beleska);
  64.         else if(type == 2)
  65.             format(dialog_str, sizeof dialog_str, "%s%s\n", dialog_str, tajtl);
  66.     }
  67.     if(type == 1)
  68.         SPD(playerid, D_NOTE_PREVIEW, DSM, "Beleske", dialog_str, "OK", "");
  69.     else if(type == 2)
  70.         SPD(playerid, D_NOTE_DELETE, DSL, "Beleske", dialog_str, "OK", "");
  71.     return 1;
  72. }
  73.  
  74. stock Add_Note(playerid, title[], text[])
  75. {
  76.     new note_str[512];
  77.     mysql_format(SQL, note_str, sizeof note_str, "INSERT INTO `notes` (Player, Title, Text) VALUES ('%s', '%s', '%s')", GetName(playerid), title, text);
  78.     mysql_tquery(SQL, note_str);
  79.     return 1;
  80. }
  81.  
  82.  
  83. komande:
  84.  
  85. CMD:notes(playerid, params[])
  86. {
  87.     SPD(playerid, D_NOTE, DSL, "Note", "Pregledaj\nIzbrisi", "OK", "");
  88.     SendClientMessage(playerid, -1, "- Da ubacite nesto u vasu belesku koristite /addnote.");
  89.     return 1;
  90. }
  91.  
  92. CMD:addnote(playerid, params[])
  93. {
  94.     if(PNotes[playerid] > MAX_P_NOTES) return SendClientMessage(playerid, -1, "Imate previse belezaka");
  95.     new naslv[20], tekt[128];
  96.     if(sscanf(params, "s[20]s[128]", naslv, tekt)) return SendClientMessage(playerid, -1, "Koristite: /addnote [naslov (SAMO 1 REC)] [text]");
  97.     Add_Note(playerid, naslv, tekt);
  98.     PNotes[playerid]++;
  99.     SacuvajIgracaInt(playerid, "PNotes", PNotes[playerid]);
  100.     return 1;
  101. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top