add ingame msg
This commit is contained in:
		
							parent
							
								
									ccd41c2e1b
								
							
						
					
					
						commit
						54d777934b
					
				
							
								
								
									
										16
									
								
								ttd.go
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								ttd.go
									
									
									
									
									
								
							@ -608,10 +608,22 @@ func (s *ServerTTD) ComputeClientTime() {
 | 
				
			|||||||
		for _, cc := range cfg.Clients {
 | 
							for _, cc := range cfg.Clients {
 | 
				
			||||||
			if cc.Online {
 | 
								if cc.Online {
 | 
				
			||||||
				if cc.TimeLeft > 0 && cc.TimeLeft < diff {
 | 
									if cc.TimeLeft > 0 && cc.TimeLeft < diff {
 | 
				
			||||||
					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s got not time left. Grace period of %s.", cc.Username, cfg.Game.Threshold))
 | 
										msg := fmt.Sprintf("@%s got not time left. Grace period of %s.", cc.Username, cfg.Game.Threshold)
 | 
				
			||||||
 | 
										bot.SendChat(cfg.Telegram.ChatID, msg)
 | 
				
			||||||
 | 
										px := PacketAdminRCon{
 | 
				
			||||||
 | 
											Packet:  Packet{PType: AdminPacketAdminRCon},
 | 
				
			||||||
 | 
											Command: fmt.Sprintf("say %s", msg),
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										srv.Send(px.Bytes())
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if (cc.TimeLeft+cfg.Game.Threshold) > 0 && (cc.TimeLeft+cfg.Game.Threshold) < diff {
 | 
									if (cc.TimeLeft+cfg.Game.Threshold) > 0 && (cc.TimeLeft+cfg.Game.Threshold) < diff {
 | 
				
			||||||
					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s got not time left. Grace period over.", cc.Username))
 | 
										msg := fmt.Sprintf("@%s got not time left. Grace period over.", cc.Username)
 | 
				
			||||||
 | 
										bot.SendChat(cfg.Telegram.ChatID, msg)
 | 
				
			||||||
 | 
										px := PacketAdminRCon{
 | 
				
			||||||
 | 
											Packet:  Packet{PType: AdminPacketAdminRCon},
 | 
				
			||||||
 | 
											Command: fmt.Sprintf("say %s", msg),
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										srv.Send(px.Bytes())
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				cc.TimeLeft = cc.TimeLeft - diff
 | 
									cc.TimeLeft = cc.TimeLeft - diff
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
// Code generated by version.sh (@generated) DO NOT EDIT.
 | 
					// Code generated by version.sh (@generated) DO NOT EDIT.
 | 
				
			||||||
package main
 | 
					package main
 | 
				
			||||||
var githash = "11ec55b"
 | 
					var githash = "ccd41c2"
 | 
				
			||||||
var buildstamp = "2021-11-13_06:23:25"
 | 
					var buildstamp = "2021-11-13_06:27:18"
 | 
				
			||||||
var commits = "197"
 | 
					var commits = "198"
 | 
				
			||||||
var version = "11ec55b-b197 - 2021-11-13_06:23:25"
 | 
					var version = "ccd41c2-b198 - 2021-11-13_06:27:18"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user