Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Vrh Moda
- #define UPIT_DIALOZI 4000
- #define YUB_UPIT UPIT_DIALOZI+1
- #define YUB_UPITUNOS UPIT_DIALOZI+2
- #define YUB_UPITLISTA UPIT_DIALOZI+3
- #define YUB_UPITLISTA2 UPIT_DIALOZI+4
- #define YUB_ODGOVORI UPIT_DIALOZI+5
- #define MAX_DIALOG_ITEMS 20
- new DialogItem[ MAX_PLAYERS ][ MAX_DIALOG_ITEMS ];
- enum upitdatainfo
- {
- uAktivno,
- uPitanje[ 91 ],
- uVrsta,
- uPogOdgovor,
- uImeAdmina[MAX_PLAYER_NAME],
- uOdgovor[ 120 ]
- }
- new UpitData[MAX_PLAYERS][upitdatainfo];
- new YUB_GledaUpit[ MAX_PLAYERS ];
- //OnPlayerDisconnect && OnPlayerConnect
- UpitData[ playerid ][ uAktivno ] = 0;
- UpitData[ playerid ][ uPogOdgovor ] = 0;
- //funkcije
- AddToDialog( playerid, id ) {
- for(new i; i < MAX_DIALOG_ITEMS; i++) {
- if(DialogItem[ playerid ][ i ] == 0) {
- DialogItem[ playerid ][ i ] = id;
- break;
- }
- }
- }
- ResetDialogItems( playerid ) {
- for(new i; i < MAX_DIALOG_ITEMS; i++) DialogItem[ playerid ][ i ] = 0;
- }
- //komande
- CMD:upit(playerid,params[]) {
- if(UpitData[ playerid ][ uAktivno ] == 1) return SendClientMessage( playerid, 0xBFBFBFAA, "Vec ste poslali upit, pricekajte odgovor.");
- if(UpitData[ id ][ uPogOdgovor ] != 0) return SendClientMessage( playerid, 0xBFBFBFAA, "Prvo pogledajte odgovor na prethodno prije nego postavite novo pitanje.");
- AC_ShowPlayerDialog( playerid, YUB_UPIT, DIALOG_STYLE_LIST, "[YUB] Upit - Odaberite vrstu", "Pitanje pomoci\nPrijava buga\nDonacija", "Odaberi", "Zatvori" );
- return 1;
- }
- CMD:upitlista(playerid,params[]) {
- if( pInfo[ playerid ][ pAdmin ] >= 1 ) { //dodaj i za gxa
- AC_ShowPlayerDialog( playerid, YUB_UPITLISTA, DIALOG_STYLE_LIST, "[YUB] Upit - Odaberite vrstu", "Pitanje pomoci\nPrijava buga\nDonacija", "Odaberi", "Zatvori" );
- }
- return 1;
- }
- CMD:podg(playerid,params[]) {
- if(UpitData[ id ][ uPogOdgovor ] == 0) return SendClientMessage( playerid, 0xBFBFBFAA, "Niste poslali pitanje ili ste vec jednom pogledali odgovor.");
- new answerstring[ 450 ];
- 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 ]);
- AC_ShowPlayerDialog( playerid, 9999, DIALOG_STYLE_MSGBOX, "[YUB] Odgovor", answerstring, "Zatvori", "" );
- return 1;
- }
- //dialozi
- if(dialogid == YUB_UPITLISTA && response) {
- new DialogListString[ 1024 ], numcount = 0;
- strdel( DialogListString, 0, sizeof( DialogListString ) );
- ResetDialogItems(playerid);
- foreach(new i : Player) {
- if(UpitData[ i ][ uVrsta ] == listitem && UpitData[ i ][ uAktivno ] == 1) {
- numcount++;
- AddToDialog( playerid, i );
- format(DialogListString, sizeof(DialogListString), "%s%d. %s [ID: %d]\n", DialogListString, numcount, GetPlayerNameEx(i), i);
- }
- }
- if(numcount > 0) AC_ShowPlayerDialog( playerid, YUB_UPITLISTA2, DIALOG_STYLE_LIST, "[YUB] Upit - Odaberite igraca", DialogListString, "Odgovori", "Odustani" );
- else SendClientMessage( playerid, 0xBFBFBFAA, "Nema postavljenih pitanja za odabranu kategoriju.");
- }
- if(dialogid == YUB_UPITLISTA2 && response) {
- YUB_GledaUpit[ playerid ] = DialogItem[ playerid ][ listitem ];
- if(!IsPlayerConnected(YUB_GledaUpit[ playerid ])) return SendClientMessage( playerid, 0xBFBFBFAA, "Igrac je u medjuvremenu napustio server.");
- if(UpitData[ YUB_GledaUpit[ playerid ] ][ uAktivno ] == 0) return SendClientMessage( playerid, 0xBFBFBFAA, "Igracu je neko u medjuvremenu odgovorio na pitanje.");
- new upitstring[ 222 ];
- format( upitstring, sizeof (upitstring), "Pitanje postavlja: %s\nPitanje: %s\n\nUnesite Vas odgovor:", GetPlayerNameEx( YUB_GledaUpit[ playerid ] ), UpitData[ YUB_GledaUpit[ playerid ] ][ uPitanje ]);
- AC_ShowPlayerDialog( playerid, YUB_ODGOVORI, DIALOG_STYLE_INPUT, "[YUB] Upit - Unesite odgovor", upitstring, "Odgovori", "Odustani" );
- }
- if(dialogid == YUB_ODGOVORI && response) {
- if(!strlen(inputtext)) return SendClientMessage( playerid, 0xBFBFBFAA, "Molimo unesite tekst.");
- if(strlen(inputtext) > 120) return SendClientMessage( playerid, 0xBFBFBFAA, "Greska! Odgovor mora biti do 120 znakova.");
- new id = YUB_GledaUpit[ playerid ], string[ 128 ];
- strmid( UpitData[ id ][ uOdgovor ], inputtext, 0, strlen( inputtext ), 90 );
- strmid( UpitData[ id ][ uImeAdmina ], GetPlayerNameEx( playerid ), 0, strlen( GetPlayerNameEx( playerid ) ), 24 );
- UpitData[ id ][ uPogOdgovor ] = 1;
- UpitData[ id ][ uAktivno ] = 0;
- format( string, sizeof( string ), "{F3FF02}[YUB] Adm | {00C0FF}Uspjesno ste poslali odgovor na pitanje igracu %s.", GetPlayerNameEx(id));
- SendClientMessage(playerid, 0xBFBFBFAA, string);
- SendClientMessage(id, 0xBFBFBFAA, "{FFFFFF}[YUB]: {00C0FF}Dobili ste odgovor iz administracije na poslani upit. {f81414}(/podg)");
- }
- if(dialogid == YUB_UPIT && response) {
- UpitData[ playerid ][ uVrsta ] = listitem;
- AC_ShowPlayerDialog(playerid, YUB_UPITUNOS, DIALOG_STYLE_INPUT,"[YUB] Upit","Unesite Vase pitanje/zahtjev:","Unesi","Odustani");
- }
- if(dialogid == YUB_UPITUNOS && response) {
- if(!strlen(inputtext)) return SendClientMessage( playerid, 0xBFBFBFAA, "Molimo unesite tekst.");
- if(strlen(inputtext) > 90) return SendClientMessage( playerid, 0xBFBFBFAA, "Greska! Upit mora biti do 90 znakova.");
- strmid( UpitData[ playerid ][ uPitanje ], inputtext, 0, strlen( inputtext ), 90 );
- SendClientMessage(playerid, 0xBFBFBFAA, "{F3FF02}Poslali ste upit administraciji, ocekujte brz odgovor.");
- UpitData[ playerid ][ uAktivno ] = 1;
- UpitData[ playerid ][ uPogOdgovor ] = 0;
- new oblast[ 18 ], string[ 144 ];
- switch( UpitData[ playerid ][ uVrsta ] ) {
- case 0: oblast = "Pitanje pomoci";
- case 1: oblast = "Prijava buga";
- case 2: oblast = "Donacija";
- default: oblast = "Pitanje pomoci";
- }
- format( string, sizeof(string), "{FFFFFF}[YUB] Adm| {F3FF02}%s je upravo poslao upit! {F81414}(/upitlista | Oblast: %s)", GetPlayerNameEx(playerid), oblast);
- SendAdminMessage( 0xBFBFBFAA, string ); //Ispravi po svom
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement