Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ----- Kniha přání a stížností v2.0 -----
- by Mort
- */
- #include <a_samp>
- #define MISTO_STIZNOSTI "Kniha/Stiznosti.txt"
- #define MISTO_PRANI "Kniha/Prani.txt"
- #define DIAL_1 100
- #define DIAL_2 101
- #define DIAL_3 102
- stock GetName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
- public OnPlayerCommandText(playerid,cmdtext[])
- {
- if(strcmp(cmdtext[1],"kniha",true)==0)
- {
- ShowPlayerDialog(playerid,DIAL_1,DIALOG_STYLE_LIST,"Zvol typ","{33FF00}Přání\n{FF0000}Stížnost","Zvolit","Zrušit");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(response)
- {
- if(dialogid == DIAL_1)
- {
- switch(listitem)
- {
- case 0:
- {
- ShowPlayerDialog(playerid,DIAL_2,DIALOG_STYLE_INPUT,"Napiš přání","Napiš, co by jsi chtěl na serveru","Odeslat","Zrušit");
- }
- case 1:
- {
- ShowPlayerDialog(playerid,DIAL_3,DIALOG_STYLE_INPUT,"Napiš štížnost","Napiš, co se ti na serveru nelíbí","Odeslat","Zrušit");
- }
- }
- }
- if(dialogid == DIAL_2)
- {
- if(!inputtext[0]) return ShowPlayerDialog(playerid,DIAL_2,DIALOG_STYLE_INPUT,"Napiš přání","Napiš, co by jsi chtěl na serveru","Odeslat","Zrušit");
- // vytvoření řetězce pro zapisování do souboru
- new string[150];
- new Year,Month,Day,Hour,Minute,Second;
- getdate(Year,Month,Day);
- gettime(Hour,Minute,Second);
- format(string,sizeof(string),"[%d/%d/%d][%02d/%02d/%02d] %s: %s\r\n",Day,Month,Year,Hour,Minute,Second,GetName(playerid),inputtext);
- // zapsání řetězce do souboru
- new File:file = fopen(MISTO_PRANI,io_append);
- if(file)
- {
- fwrite(file,string);
- }
- fclose(file);
- //
- SendClientMessage(playerid,-1,"Děkujeme za Váš názor");
- }
- if(dialogid == DIAL_3)
- {
- if(!inputtext[0]) return ShowPlayerDialog(playerid,DIAL_2,DIALOG_STYLE_INPUT,"Napiš přání","Napiš, co by jsi chtěl na serveru","Odeslat","Zrušit");
- // vytvoření řetězce pro zapisování do souboru
- new string[150];
- new Year,Month,Day,Hour,Minute,Second;
- getdate(Year,Month,Day);
- gettime(Hour,Minute,Second);
- format(string,sizeof(string),"[%d/%d/%d][%02d/%02d/%02d] %s: %s\r\n",Day,Month,Year,Hour,Minute,Second,GetName(playerid),inputtext);
- // zapsání řetězce do souboru
- new File:file = fopen(MISTO_STIZNOSTI,io_append);
- if(file)
- {
- fwrite(file,string);
- }
- fclose(file);
- //
- SendClientMessage(playerid,-1,"Děkujeme za Váš názor");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement