diff --git a/gamemodes/irresistible/cnr/commands/_commands.pwn b/gamemodes/irresistible/cnr/commands/_commands.pwn index c380983..39c9c1d 100644 --- a/gamemodes/irresistible/cnr/commands/_commands.pwn +++ b/gamemodes/irresistible/cnr/commands/_commands.pwn @@ -12,4 +12,5 @@ #include "irresistible\cnr\commands\cmd_changes.pwn" #include "irresistible\cnr\commands\cmd_twitter.pwn" #include "irresistible\cnr\commands\cmd_highscores.pwn" -#include "irresistible\cnr\commands\cmd_nametags.pwn" \ No newline at end of file +#include "irresistible\cnr\commands\cmd_nametags.pwn" +#include "irresistible\cnr\commands\cmd_feedback.pwn" \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/commands/cmd_feedback.pwn b/gamemodes/irresistible/cnr/commands/cmd_feedback.pwn new file mode 100644 index 0000000..360c261 --- /dev/null +++ b/gamemodes/irresistible/cnr/commands/cmd_feedback.pwn @@ -0,0 +1,37 @@ +/* + * Irresistible Gaming (c) 2018 + * Developed by Lorenc + * Module: cnr\commands\cmd_feedback.pwn + * Purpose: create /feedback (or /suggest) about the server + */ + +/* ** Includes ** */ +#include < YSI\y_hooks > + +/* ** Commands ** */ +CMD:suggest( playerid, params[ ] ) return cmd_feedback( playerid, params ); +CMD:feedback( playerid, params[ ] ) +{ + return ShowPlayerDialog( playerid, DIALOG_FEEDBACK, DIALOG_STYLE_INPUT, ""COL_GOLD"Server Feedback", ""COL_WHITE"Let us know how you think we can make the server better to play! Impactful feedback is rewarded.\n\n Be as serious and straight forward as you wish. You can rant if you need to. Be impactful.", "Submit", "Close" ); +} + +/* ** Hooks ** */ +hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) +{ + if ( ( dialogid == DIALOG_FEEDBACK ) && response ) + { + if ( ! ( 10 < strlen( inputtext ) <= 512 ) ) + { + SendError( playerid, "Your feedback must be between 10 and 512 characters long." ); + return ShowPlayerDialog( playerid, DIALOG_FEEDBACK, DIALOG_STYLE_INPUT, ""COL_GOLD"Server Feedback", ""COL_WHITE"Let us know how you think we can make the server better to play! Impactful feedback is rewarded.\n\n Be as serious and straight forward as you wish. You can rant if you need to. Be impactful.\n\n"COL_RED"Your feedback must be between 10 and 512 characters long.", "Submit", "Close" ); + } + + // insert into database + mysql_format( dbHandle, szLargeString, sizeof( szLargeString ), "INSERT INTO `FEEDBACK` (`USER_ID`, `FEEDBACK`) VALUES (%d, '%e')", p_AccountID[ playerid ], inputtext ); + mysql_single_query( szLargeString ); + + format( szLargeString, sizeof( szLargeString ), ""COL_GOLD"Thank you for your feedback!"COL_WHITE" If it can make a positive impact on the server then you will be rewarded.\n\nYou can speak as freely as you want. Be vulgar, serious if you need to. It's okay as long as it's constructive.\n\nHere is what you have submitted!\n\n"COL_GREY"%s", szFeedback ); + return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, ""COL_GOLD"Server Feedback", szLargeString, "Close", "" ); + } + return 1; +} \ No newline at end of file diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 33ae648..da64b8c 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -2194,12 +2194,6 @@ CMD:changename( playerid, params[ ] ) { return 1; } -CMD:suggest( playerid, params[ ] ) return cmd_feedback( playerid, params ); -CMD:feedback( playerid, params[ ] ) -{ - return ShowPlayerDialog( playerid, DIALOG_FEEDBACK, DIALOG_STYLE_INPUT, ""COL_GOLD"Server Feedback", ""COL_WHITE"Let us know how you think we can make the server better to play! Impactful feedback is rewarded.\n\n Be as serious and straight forward as you wish. You can rant if you need to. Be impactful.", "Submit", "Close" ); -} - CMD:request( playerid, params[ ] ) { /* ** Anti Spammy Commands ** */ @@ -7095,27 +7089,6 @@ public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) } } } - if ( ( dialogid == DIALOG_FEEDBACK ) && response ) - { - if ( ! ( 10 < strlen( inputtext ) <= 512 ) ) - { - SendError( playerid, "Your feedback must be between 10 and 512 characters long." ); - return ShowPlayerDialog( playerid, DIALOG_FEEDBACK, DIALOG_STYLE_INPUT, ""COL_GOLD"Server Feedback", ""COL_WHITE"Let us know how you think we can make the server better to play! Impactful feedback is rewarded.\n\n Be as serious and straight forward as you wish. You can rant if you need to. Be impactful.\n\n"COL_RED"Your feedback must be between 10 and 512 characters long.", "Submit", "Close" ); - } - - new - szFeedback[ 512 ]; - - // escape feedback - mysql_real_escape_string( inputtext, szFeedback ); - - // insert into database - format( szLargeString, sizeof( szLargeString ), "INSERT INTO `FEEDBACK` (`USER_ID`, `FEEDBACK`) VALUES (%d, '%s')", p_AccountID[ playerid ], szFeedback ); - mysql_single_query( szLargeString ); - - format( szLargeString, sizeof( szLargeString ), ""COL_GOLD"Thank you for your feedback!"COL_WHITE" If it can make a positive impact on the server then you will be rewarded.\n\nYou can speak as freely as you want. Be vulgar, serious if you need to. It's okay as long as it's constructive.\n\nHere is what you have submitted!\n\n"COL_GREY"%s", szFeedback ); - return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_MSGBOX, ""COL_GOLD"Server Feedback", szLargeString, "Close", "" ); - } if ( dialogid == DIALOG_AIRPORT && response ) { static const