Advertisement
dann1s

Upit Sistem

Sep 12th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.04 KB | None | 0 0
  1.  
  2. //Vrh Moda
  3. #define UPIT_DIALOZI 4000
  4. #define YUB_UPIT UPIT_DIALOZI+1
  5. #define YUB_UPITUNOS UPIT_DIALOZI+2
  6. #define YUB_UPITLISTA UPIT_DIALOZI+3
  7. #define YUB_UPITLISTA2 UPIT_DIALOZI+4
  8. #define YUB_ODGOVORI UPIT_DIALOZI+5
  9. #define MAX_DIALOG_ITEMS 20
  10. new DialogItem[ MAX_PLAYERS ][ MAX_DIALOG_ITEMS ];
  11.  
  12. enum    upitdatainfo
  13. {
  14.     uAktivno,
  15.     uPitanje[ 91 ],
  16.     uVrsta,
  17.     uPogOdgovor,
  18.     uImeAdmina[MAX_PLAYER_NAME],
  19.     uOdgovor[ 120 ]
  20. }
  21. new UpitData[MAX_PLAYERS][upitdatainfo];
  22. new YUB_GledaUpit[ MAX_PLAYERS ];
  23.  
  24. //OnPlayerDisconnect && OnPlayerConnect
  25. UpitData[ playerid ][ uAktivno ] = 0;
  26. UpitData[ playerid ][ uPogOdgovor ] = 0;
  27.  
  28. //funkcije
  29. AddToDialog( playerid, id ) {
  30.  
  31.     for(new i; i < MAX_DIALOG_ITEMS; i++) {
  32.         if(DialogItem[ playerid ][ i ] == 0) {
  33.             DialogItem[ playerid ][ i ] = id;
  34.             break;
  35.         }
  36.     }
  37.    
  38. }
  39.  
  40. ResetDialogItems( playerid ) {
  41.     for(new i; i < MAX_DIALOG_ITEMS; i++) DialogItem[ playerid ][ i ] = 0;
  42. }
  43.  
  44. //komande
  45. CMD:upit(playerid,params[]) {
  46.     if(UpitData[ playerid ][ uAktivno ] == 1) return SendClientMessage( playerid, 0xBFBFBFAA, "Vec ste poslali upit, pricekajte odgovor.");
  47.     if(UpitData[ id ][ uPogOdgovor ] != 0) return SendClientMessage( playerid, 0xBFBFBFAA, "Prvo pogledajte odgovor na prethodno prije nego postavite novo pitanje.");
  48.     AC_ShowPlayerDialog( playerid, YUB_UPIT, DIALOG_STYLE_LIST, "[YUB] Upit - Odaberite vrstu", "Pitanje pomoci\nPrijava buga\nDonacija", "Odaberi", "Zatvori" );
  49.     return 1;
  50. }
  51.  
  52. CMD:upitlista(playerid,params[]) {
  53.     if( pInfo[ playerid ][ pAdmin ] >= 1  ) { //dodaj i za gxa
  54.         AC_ShowPlayerDialog( playerid, YUB_UPITLISTA, DIALOG_STYLE_LIST, "[YUB] Upit - Odaberite vrstu", "Pitanje pomoci\nPrijava buga\nDonacija", "Odaberi", "Zatvori" );
  55.     }
  56.     return 1;
  57. }
  58.  
  59. CMD:podg(playerid,params[]) {
  60.     if(UpitData[ id ][ uPogOdgovor ] == 0) return SendClientMessage( playerid, 0xBFBFBFAA, "Niste poslali pitanje ili ste vec jednom pogledali odgovor.");
  61.     new answerstring[ 450 ];
  62.     format(answerstring, sizeof(answerstring), "Vase pitanje glasi: %s\n\nOdgovor: %s\n\nS postovanjem, %s - YUB Admin Team.", UpitData[ playerid ][ uPitanje ], UpitData[ playerid ][ uOdgovor ], UpitData[ playerid ][ uImeAdmina ]);
  63.     AC_ShowPlayerDialog( playerid, 9999, DIALOG_STYLE_MSGBOX, "[YUB] Odgovor", answerstring, "Zatvori", "" );
  64.     return 1;
  65. }
  66.  
  67. //dialozi
  68.  
  69. if(dialogid == YUB_UPITLISTA && response) {
  70.     new DialogListString[ 1024 ], numcount = 0;
  71.     strdel( DialogListString, 0, sizeof( DialogListString ) );
  72.     ResetDialogItems(playerid);
  73.     foreach(new i : Player) {
  74.         if(UpitData[ i ][ uVrsta ] == listitem && UpitData[ i ][ uAktivno ] == 1) {
  75.             numcount++;
  76.             AddToDialog( playerid, i );
  77.             format(DialogListString, sizeof(DialogListString), "%s%d. %s [ID: %d]\n", DialogListString, numcount, GetPlayerNameEx(i), i);
  78.         }
  79.     }
  80.     if(numcount > 0) AC_ShowPlayerDialog( playerid, YUB_UPITLISTA2, DIALOG_STYLE_LIST, "[YUB] Upit - Odaberite igraca", DialogListString, "Odgovori", "Odustani" );
  81.     else SendClientMessage( playerid, 0xBFBFBFAA, "Nema postavljenih pitanja za odabranu kategoriju.");
  82. }
  83.  
  84. if(dialogid == YUB_UPITLISTA2 && response) {
  85.     YUB_GledaUpit[ playerid ] = DialogItem[ playerid ][ listitem ];
  86.     if(!IsPlayerConnected(YUB_GledaUpit[ playerid ])) return SendClientMessage( playerid, 0xBFBFBFAA, "Igrac je u medjuvremenu napustio server.");
  87.     if(UpitData[ YUB_GledaUpit[ playerid ] ][ uAktivno ] == 0) return SendClientMessage( playerid, 0xBFBFBFAA, "Igracu je neko u medjuvremenu odgovorio na pitanje.");
  88.     new upitstring[ 222 ];
  89.     format( upitstring, sizeof (upitstring), "Pitanje postavlja: %s\nPitanje: %s\n\nUnesite Vas odgovor:", GetPlayerNameEx( YUB_GledaUpit[ playerid ] ), UpitData[ YUB_GledaUpit[ playerid ] ][ uPitanje ]);
  90.     AC_ShowPlayerDialog( playerid, YUB_ODGOVORI, DIALOG_STYLE_INPUT, "[YUB] Upit - Unesite odgovor", upitstring, "Odgovori", "Odustani" );
  91. }
  92.  
  93. if(dialogid == YUB_ODGOVORI && response) {
  94.     if(!strlen(inputtext)) return SendClientMessage( playerid, 0xBFBFBFAA, "Molimo unesite tekst.");
  95.     if(strlen(inputtext) > 120) return SendClientMessage( playerid, 0xBFBFBFAA, "Greska! Odgovor mora biti do 120 znakova.");
  96.     new id = YUB_GledaUpit[ playerid ], string[ 128 ];
  97.     strmid( UpitData[ id ][ uOdgovor ], inputtext, 0, strlen( inputtext ), 90 );
  98.     strmid( UpitData[ id ][ uImeAdmina ], GetPlayerNameEx( playerid ), 0, strlen( GetPlayerNameEx( playerid ) ), 24 );
  99.     UpitData[ id ][ uPogOdgovor ] = 1;
  100.     UpitData[ id ][ uAktivno ] = 0;
  101.     format( string, sizeof( string ), "{F3FF02}[YUB] Adm | {00C0FF}Uspjesno ste poslali odgovor na pitanje igracu %s.", GetPlayerNameEx(id));
  102.     SendClientMessage(playerid, 0xBFBFBFAA, string);
  103.     SendClientMessage(id, 0xBFBFBFAA, "{FFFFFF}[YUB]: {00C0FF}Dobili ste odgovor iz administracije na poslani upit. {f81414}(/podg)");
  104.    
  105. }
  106.  
  107. if(dialogid == YUB_UPIT && response) {
  108.     UpitData[ playerid ][ uVrsta ] = listitem;
  109.     AC_ShowPlayerDialog(playerid, YUB_UPITUNOS, DIALOG_STYLE_INPUT,"[YUB] Upit","Unesite Vase pitanje/zahtjev:","Unesi","Odustani");
  110. }
  111.  
  112. if(dialogid == YUB_UPITUNOS && response) {
  113.     if(!strlen(inputtext)) return SendClientMessage( playerid, 0xBFBFBFAA, "Molimo unesite tekst.");
  114.     if(strlen(inputtext) > 90) return SendClientMessage( playerid, 0xBFBFBFAA, "Greska! Upit mora biti do 90 znakova.");
  115.     strmid( UpitData[ playerid ][ uPitanje ], inputtext, 0, strlen( inputtext ), 90 );
  116.     SendClientMessage(playerid, 0xBFBFBFAA, "{F3FF02}Poslali ste upit administraciji, ocekujte brz odgovor.");
  117.     UpitData[ playerid ][ uAktivno ] = 1;
  118.     UpitData[ playerid ][ uPogOdgovor ] = 0;
  119.     new oblast[ 18 ], string[ 144 ];
  120.     switch( UpitData[ playerid ][ uVrsta ] ) {
  121.         case 0: oblast = "Pitanje pomoci";
  122.         case 1: oblast = "Prijava buga";
  123.         case 2: oblast = "Donacija";
  124.         default: oblast = "Pitanje pomoci";
  125.     }
  126.     format( string, sizeof(string), "{FFFFFF}[YUB] Adm| {F3FF02}%s je upravo poslao upit! {F81414}(/upitlista | Oblast: %s)", GetPlayerNameEx(playerid), oblast);
  127.     SendAdminMessage( 0xBFBFBFAA, string ); //Ispravi po svom
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement