Skip to content

Commit

Permalink
chat event
Browse files Browse the repository at this point in the history
  • Loading branch information
ineedbots committed Apr 26, 2024
1 parent 582268a commit 755541e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
19 changes: 19 additions & 0 deletions maps/mp/bots/_bot.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ init()
level thread watchScrabler();

level thread handleBots();
level thread onPlayerChat();
}

/*
Expand Down Expand Up @@ -1329,3 +1330,21 @@ doFiringThread()
wait 1;
self.bots_firing = false;
}

/*
When a player chats
*/
onPlayerChat()
{
for ( ;; )
{
level waittill( "say", message, player, is_hidden );

for ( i = 0; i < level.bots.size; i++ )
{
bot = level.bots[ i ];

bot BotNotifyBotEvent( "chat", "chat", message, player, is_hidden );
}
}
}
12 changes: 12 additions & 0 deletions maps/mp/bots/_bot_chat.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,22 @@ start_chat_watch()
case "connection":
self thread bot_chat_connection_player_watch( a, b, c, d, e, f, g );
break;

case "chat":
self thread bot_chat_chat_player_watch( a, b, c, d, e, f, g );
break;
}
}
}

/*
When another player chats
*/
bot_chat_chat_player_watch( chatstr, message, player, is_hidden, e, f, g )
{
self endon( "disconnect" );
}

/*
When a player connected
*/
Expand Down

0 comments on commit 755541e

Please sign in to comment.