fixed 4wins game counter and prevent players playing against their selves...
[NeonServV5.git] / src / modules / NeonFun.mod / cmd_neonfun_4wins.c
index a282a144d836c2e65e5f9d386b3072d9eb6ba4aa..2aafcb69f464d01f7dac82c6dfc1c4b0d4133fcb 100644 (file)
@@ -36,6 +36,11 @@ CMD_BIND(neonfun_cmd_4wins) {
         timeq_del(game->timer);
         game->timer = NULL;
         game->state = FOURWINS_STATE_RUNNING;
+        if((game->player[0]->user->flags & USERFLAG_ISAUTHED) && (game->player[1]->user->flags & USERFLAG_ISAUTHED) && !stricmp(game->player[0]->user->auth, game->player[1]->user->auth)) {
+            fourwins_reply(game, "NF_4WINS_SELF");
+            fourwins_free_game(game);
+            return;
+        }
         fourwins_reply(game, "NF_4WINS_START", user->nick);
         if((game->player[0]->user->flags & USERFLAG_ISAUTHED)) {
             char *tmp;
@@ -74,6 +79,10 @@ CMD_BIND(neonfun_cmd_4wins) {
             reply(getTextBot(), user, "NS_USER_UNKNOWN", argv[0]);
             return;
         }
+        if(opp_user == user) {
+            reply(getTextBot(), user, "NF_4WINS_SELF");
+            return;
+        }
         struct ChanUser *opponent = getChanUser(opp_user, chan);
         if(!opponent) {
             reply(getTextBot(), user, "NF_4WINS_OPPONENT_NOT_IN_CHAN", opp_user->nick);