示例#1
0
func fumbleAllowPlayer(lobbyId uint, playerName string, playerTeam string) error {
	if config.Constants.FumbleAddr == "" {
		return nil
	}

	user := mumble.User{}
	user.Name = playerName
	user.Team = mumble.Team(playerTeam)

	err := call(config.Constants.FumbleAddr, "Fumble.AllowPlayer", &mumble.LobbyArgs{user, lobbyId}, &struct{}{})
	if err != nil {
		logrus.Warning(err.Error())
	}

	return nil
}
示例#2
0
func FumbleAllowPlayer(lobbyId uint, playerName string, playerTeam string) error {
	if Fumble == nil {
		return nil
	}

	user := mumble.NewUser()
	user.Name = playerName
	user.Team = mumble.Team(playerTeam)

	FumbleLobbiesLock.Lock()
	defer FumbleLobbiesLock.Unlock()

	reply := new(mumble.Lobby)

	err := Fumble.Call("Fumble.AllowPlayer", &mumble.LobbyArgs{user, FumbleLobbies[lobbyId]}, reply)
	if err != nil {
		helpers.Logger.Warning(err.Error())
	}
	FumbleLobbiesLock.Lock()
	defer FumbleLobbiesLock.Unlock()
	FumbleLobbies[lobbyId] = reply
	return nil
}