Skip to content

Commit

Permalink
chat event
Browse files Browse the repository at this point in the history
  • Loading branch information
ineed bots committed Apr 26, 2024
1 parent 1e0daca commit b470885
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 @@ -288,6 +288,7 @@ init()
level thread auditModels();

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

/*
Expand Down Expand Up @@ -1580,3 +1581,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 @@ -332,10 +332,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 b470885

Please sign in to comment.